Verilog_Code_and_Explanation
Verilog_Code_and_Explanation
Module: part1_1a
Verilog Code:
input s;
input [7:0] x, y;
output [7:0] m;
endmodule
Module: part2_1a
Verilog Code:
input u, v, w, x, y;
input [2:0] s;
output m;
assign mux[0] = u;
assign mux[1] = v;
assign mux[2] = w;
assign mux[3] = x;
assign mux[4] = y;
assign m = mux[s];
endmodule
Module: part1_1b
Verilog Code:
input [2:0] c;
3'b000: s = 7'b0001001;
3'b001: s = 7'b1001111;
3'b010: s = 7'b0010010;
3'b011: s = 7'b0000110;
3'b100: s = 7'b1001100;
3'b101: s = 7'b0100100;
3'b110: s = 7'b0100000;
3'b111: s = 7'b0001111;
default: s = 7'b1111111;
endcase
end
endmodule
Module: part2_1b
Verilog Code:
input a, b, c, d, e, f;
input [2:0] s;
output m;
assign mux[0] = a;
assign mux[1] = b;
assign mux[2] = c;
assign mux[3] = d;
assign mux[4] = e;
assign mux[5] = f;
assign m = mux[s];
endmodule
Module: part1
Purpose: Main module that integrates components for 7-segment display output.
Verilog Code:
input [3:0] v, b;
wire z;
wire [3:0] m;
endmodule
Module: lab2bmain
Verilog Code:
module lab2bmain (A0, B0, A1, B1, A2, B2, A3, B3, cin, disp1, disp0);
input cin;
wire [3:0] s;
wire z, compOUTFLOW;
endmodule