From 263d3a93db7af18bb1b420c977910e5558387034 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jan 2023 22:21:48 -0500 Subject: [PATCH] Second part of Video --- .../part 3/Full Adder/Full Adder.pcf | 10 +++++++++ .../part 3/Full Adder/Full Adder.v | 21 +++++++++++++++++++ digikey tutorials/part 3/and_gate.pcf | 10 ++++++--- digikey tutorials/part 3/and_gate.v | 18 ++++++++++------ 4 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 digikey tutorials/part 3/Full Adder/Full Adder.pcf create mode 100644 digikey tutorials/part 3/Full Adder/Full Adder.v diff --git a/digikey tutorials/part 3/Full Adder/Full Adder.pcf b/digikey tutorials/part 3/Full Adder/Full Adder.pcf new file mode 100644 index 0000000..1075365 --- /dev/null +++ b/digikey tutorials/part 3/Full Adder/Full Adder.pcf @@ -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 \ No newline at end of file diff --git a/digikey tutorials/part 3/Full Adder/Full Adder.v b/digikey tutorials/part 3/Full Adder/Full Adder.v new file mode 100644 index 0000000..25e42a0 --- /dev/null +++ b/digikey tutorials/part 3/Full Adder/Full Adder.v @@ -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 \ No newline at end of file diff --git a/digikey tutorials/part 3/and_gate.pcf b/digikey tutorials/part 3/and_gate.pcf index 776763b..1075365 100644 --- a/digikey tutorials/part 3/and_gate.pcf +++ b/digikey tutorials/part 3/and_gate.pcf @@ -1,6 +1,10 @@ #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 -set_io -pullup yes pmod_0 78 -set_io -pullup yes pmod_1 79 \ No newline at end of file +set_io -pullup yes pmod[0] 78 +set_io -pullup yes pmod[1] 79 \ No newline at end of file diff --git a/digikey tutorials/part 3/and_gate.v b/digikey tutorials/part 3/and_gate.v index a3ea808..857c954 100644 --- a/digikey tutorials/part 3/and_gate.v +++ b/digikey tutorials/part 3/and_gate.v @@ -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 \ No newline at end of file