Question: I am supposed to be using these modules to create a multiplier. I am getting an X for my product. Could you please spot my

I am supposed to be using these modules to create a multiplier. I am getting an X for my product. Could you please spot my mistake?
// Problem 1
module partialMultiplier #(parameter size=4)(input clk, reset, input [size-1:0] A, B,
output logic [2*size-1:0] Product);
logic [2*size-1:0] ASum, PSum, sum_out, shiftedA;
logic[size-1:0] index;
logic B_i, Cout;
assign B_i=B[index];
Shiftreg #(size) shift1(clk, reset, A, index==0, shiftedA);
Index #(size) index1(clk, reset, index);
Mux21 #(size) mux(shiftedA,8'd0, B_i, PSum);
RippleCarryAdder #(size) adder1(ASum, PSum, 1'b0, sum_out, Cout);
Accumulator #(size) accum1(clk, reset, sum_out, ASum);
assign Product = ASum;
endmodule
module Shiftreg #(parameter size=4)(input clk, reset, input [size-1:0] A, input Loadn,
output logic [2*size-1:0] Y_shift);
localparam zero={size{1'b0}};
logic [2*size-1:0] Y;
// register
always_ff @ (posedge clk or posedge reset)
if (reset)
Y ={2*size {1'b0}};
else
Y = Y_shift;
// combinatorial, do shift
always_comb begin
Y_shift ={size{1'b0}};
case (Loadn)
1'b0 : Y_shift ={zero,A};
1'b1 : Y_shift = Y 1;
default : Y_shift ={2*size{1'b0}};
endcase
end
endmodule
module Mux21 #(parameter size =4)(input [2*size-1:0] A, C, input B,
output logic [2*size-1:0] PSum);
always_comb begin
PSum ={size{1'b0}};
case(B)
1'b0 : PSum = C;
1'b1 : PSum = A;
default : PSum ={size{1'b0}};
endcase
end
endmodule
module HalfAdder (input A, B, output logic Sum, Cout);
assign Sum = A ^ B;
assign Cout = A & B;
endmodule
module FullAdder (input A, B, Cin, output logic Sum, Cout);
logic Sum1, Cout1, Cout2;
HalfAdder H1(A, B, Sum1, Cout1);
HalfAdder H2(Sum1, Cin, Sum, Cout2);
assign Cout = Cout1| Cout2;
endmodule
module RippleCarryAdder #(parameter size=4)(input [2*size-1:0] A, B, input Cin,
output logic [2*size-1:0] Sum, output logic Cout);
genvar i;
logic [size:0] Carry;
assign Carry[0]= Cin;
generate
for (i=0; i
I am supposed to be using these modules to create

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!