2020年4月11日 星期六

1 bit comparator 比較器 in Verilog with gate level

1 bit comparator 比較器 in Verilog  with gate level




module compare(a, b, L, E,G);
input a, b;
output L, E, G;
wire s1, s2;

not X1(s1, a);
not X2 (s2, b);

and X3 (L,s1, b);
and X4 (G,s2, a);
xnor X5 (E, a, b);


endmodule


// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps 
module TB;
/*
module b_comp1 (a, b, L, E,G);
input a, b; 
output L, E, G;
*/
reg a=1'b0;
reg b=1'b0;
wire L,E,G;

compare UUT(a, b, L, E,G);
initial
begin
#50 
a=1'b0;b=1'b1;
#50 
a=1'b1;b=1'b0;
#50 
a=1'b1;b=1'b1;
#50 
$stop;

end
endmodule


沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...