Second part of Video
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
// Modeule: when buttons 1 and 2 are pressed, turn on LED
|
||||
// module: button 0 lights up 2 leds, button 0 and 1 light up another
|
||||
|
||||
module and_gate (
|
||||
// Inputs
|
||||
input pmod_0,
|
||||
input pmod_1,
|
||||
input [1:0] pmod,
|
||||
|
||||
// Outputs
|
||||
output led_0
|
||||
output [3:0] led
|
||||
);
|
||||
|
||||
// Continuous assignment: not and and operators
|
||||
assign led_0 = ~pmod_0 & ~pmod_1;
|
||||
// Wire (net) declarations (internal to module)
|
||||
wire not_pmod_0;
|
||||
|
||||
// Continous assignmen:replicate 1 wire to 2 outputs
|
||||
assign not_pmod_0 = ~pmod[0];
|
||||
assign led[1:0] = {2{not_pmod_0}};
|
||||
|
||||
// Continuous assignment: NOT and AND operators
|
||||
assign led[2] = not_pmod_0 & ~pmod[1];
|
||||
|
||||
endmodule
|
||||
Reference in New Issue
Block a user