1
0
mirror of https://github.com/olofk/serv.git synced 2026-01-13 15:17:25 +00:00
olofk.serv/rtl/ser_add.v
2018-11-21 13:15:33 +01:00

26 lines
395 B
Verilog

`default_nettype none
module ser_add
(
input wire clk,
input wire rst,
input wire a,
input wire b,
input wire clr,
output wire q,
output wire o_v);
reg c_r;
wire axorb = a^b;
assign o_v = (axorb & c_r) | (a&b);
assign q = axorb ^ c_r;
always @(posedge clk)
if (rst)
c_r <= 1'b0;
else
c_r <= !clr & o_v;
endmodule