Second part of Video

This commit is contained in:
dan
2023-01-28 22:21:48 -05:00
parent 414f3212d1
commit 263d3a93db
4 changed files with 50 additions and 9 deletions

View File

@@ -0,0 +1,10 @@
#LEDs
set_io led[0] 99
set_io led[1] 98
set_io led[2] 97
set_io led[3] 96
set_io led[4] 95
#PMOD I/0
set_io -pullup yes pmod[0] 78
set_io -pullup yes pmod[1] 79

View File

@@ -0,0 +1,21 @@
// module: button 0 lights up 2 leds, button 0 and 1 light up another
module full_adder (
// Inputs
input [1:0] pmod,
// Outputs
output [3:0] led
);
// 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

View File

@@ -1,6 +1,10 @@
#LEDs #LEDs
set_io led_0 99 set_io led[0] 99
set_io led[1] 98
set_io led[2] 97
set_io led[3] 96
set_io led[4] 95
#PMOD I/0 #PMOD I/0
set_io -pullup yes pmod_0 78 set_io -pullup yes pmod[0] 78
set_io -pullup yes pmod_1 79 set_io -pullup yes pmod[1] 79

View File

@@ -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 ( module and_gate (
// Inputs // Inputs
input pmod_0, input [1:0] pmod,
input pmod_1,
// Outputs // Outputs
output led_0 output [3:0] led
); );
// Continuous assignment: not and and operators // Wire (net) declarations (internal to module)
assign led_0 = ~pmod_0 & ~pmod_1; 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 endmodule