Second part of Video
This commit is contained in:
21
digikey tutorials/part 3/Full Adder/Full Adder.v
Normal file
21
digikey tutorials/part 3/Full Adder/Full Adder.v
Normal 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
|
||||
Reference in New Issue
Block a user