2020年4月1日 星期三

Half Adder Dataflow Model in Verilog

Half Adder Dataflow Model in Verilog 

源自於https://electronicstopper.blogspot.com/2017/06/half-adder-dataflow-model-in-verilog.html

Code:


module half_adder (input a, b, output s, c);
assign s = a ^ b;
assign c = a & b;
endmodule 

Testbench Code:


module half_adder_verilog_tb();

reg a, b;
wire s, c;

half_adder dut (.a(a), .b(b), .s(s), .c(c));

initial
begin

a = 1'b0;
b = 1'b0;
#50;

a = 1'b0;
b = 1'b1;
#50;

a = 1'b1;
b = 1'b0;
#50;

a = 1'b1;
b = 1'b1;

end

endmodule

Output:

沒有留言:

張貼留言

WOKWI DHT22 & LED , Node-Red + SQLite database

 WOKWI DHT22 & LED , Node-Red + SQLite database Node-Red程式 [{"id":"6f0240353e534bbd","type":"comment&...