Created
April 6, 2013 09:05
-
-
Save anonymous/5325489 to your computer and use it in GitHub Desktop.
This file contains 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 Tiny(switch, led, dip); | |
input [1:0] switch; | |
input [3:0] dip; | |
output [7:0] led; | |
reg ff; | |
wire d, clk, w1, w2, q1, nq1, w3, w4, q2, nq2; | |
function NAND; | |
input x, y; | |
begin | |
NAND = ~(x & y); | |
end | |
endfunction | |
assign d = dip[0]; | |
assign clk = ~switch[0]; | |
assign w1 = NAND(d, ~clk); | |
assign w2 = NAND(w1, ~clk); | |
assign led[7] = d; | |
assign led[6] = w1; | |
assign led[5] = w2; | |
assign q1 = NAND(w1, nq1); | |
assign nq1 = NAND(w2, q1); | |
assign led[4] = q1; | |
assign w3 = NAND(q1, clk); | |
assign w4 = NAND(w3, clk); | |
assign led[3] = w3; | |
assign led[2] = w4; | |
assign q2 = NAND(w3, nq2); | |
assign nq2 = NAND(w4, q2); | |
assign led[1] = q2; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment