Created
November 17, 2017 22:15
-
-
Save wuerges/ca3b79d867dcf2509cd3e1399669e1e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module circuito1( | |
input b3, | |
input b2, | |
input b1, | |
input b0, | |
output s0); | |
wire [3:0] entrada = {b3, b2, b1, b0}; | |
/* | |
assign s0 = | |
(entrada == 0) | |
| (entrada == 2) | |
| (entrada == 3) | |
| (entrada == 5) | |
| (entrada == 6) | |
| (entrada == 7) | |
| (entrada == 8) | |
| (entrada == 9); | |
*/ | |
assign s0 = | |
~( (entrada == 1) | |
|(entrada == 4) ); | |
endmodule | |
module testbench; | |
reg i_b3, i_b2, i_b1, i_b0; | |
wire o; | |
circuito1 teste(i_b3, i_b2, i_b1, i_b0, o); | |
initial begin | |
$dumpvars; | |
i_b3 = 0; i_b2 = 0; i_b1 = 0; i_b0 = 0; | |
#4; | |
i_b3 = 0; i_b2 = 0; i_b1 = 0; i_b0 = 1; | |
#4; | |
i_b3 = 0; i_b2 = 0; i_b1 = 1; i_b0 = 0; | |
#4; | |
i_b3 = 0; i_b2 = 0; i_b1 = 1; i_b0 = 1; | |
#4; | |
i_b3 = 0; i_b2 = 1; i_b1 = 0; i_b0 = 0; | |
#4; | |
i_b3 = 0; i_b2 = 1; i_b1 = 0; i_b0 = 1; | |
#4; | |
i_b3 = 0; i_b2 = 1; i_b1 = 1; i_b0 = 0; | |
#4; | |
i_b3 = 0; i_b2 = 1; i_b1 = 1; i_b0 = 1; | |
#4; | |
i_b3 = 1; i_b2 = 0; i_b1 = 0; i_b0 = 0; | |
#4; | |
i_b3 = 1; i_b2 = 0; i_b1 = 0; i_b0 = 1; | |
#4; | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment