Estoy haciendo un código para la codificación de la cabina de radix-4 para la multiplicación de 8 * 8. La lógica es correcta y no hay errores ni advertencias. La salida que estoy obteniendo no tiene ninguna relación. He publicado el siguiente código
module comp8mul (a, b, outc, clk);
input [7:0] a, b;
input clk;
output [4:0] outc;
wire [8:0] a1;
reg [8:0] a12;
wire [11:0] b1;
integer i;
reg [2:0] c1;
reg [11:0] ou1;
reg [4:0] b11 [0:11];
reg [4:0] s1;
assign a1 = {1'b0,a};
assign b1 = {1'b0,b,1'b0,1'b0};
always @(posedge clk) begin
for (i=11; i>=2'd2; i=i-(2'd2)) begin:rloop
c1={b1[i-2'd2],b1[i-1'b1],b1[i]};
case(c1)
3'b000: begin
ou1=11'b0;
s1[(i-(2'd3))/2'd2]=1'b0;
end
3'b001: begin
ou1=a1;
s1[(i-(2'd3))/2'd2]=1'b0;
end
3'b010: begin
ou1=a1;
s1[(i-2'd3)/2'd2]=1'b0;
end
3'b011: begin
a12=a1<<1;
ou1=(~a12)+1'b1;
s1[(i-(2'd3))/2'd2]=1'b1;
end
3'b100: begin
a12=a1<<1'b1;
ou1=(~a12)+1'b1;
s1[(i-(2'd3))/2'd2]=1'b1;
end
3'b101: begin
ou1=(~a1);
s1[(i-(2'd3))/2'd2]=1'b1;
end
3'b110: begin
ou1=(~a1);
s1[(i-(2'd3))/2'd2]=1'b1;
end
3'b111: begin
ou1=12'b0;
s1[(i-(2'd3))/2'd2]=1'b0;
end
endcase
if (((i-(2'd3))/2'd2)==3'd4) begin
b11[((i-(2'd3))/(2'd2))]={(~s1[(i-(2'd3))/(2'd2)]),s1[(i-(2'd3))/(2'd2)],s1[(i-(2'd3))/2'd2],ou1};
end
if (((i-(2'd3))/(2'd2))==1'b1) begin
b11[(i-(2'd3))/(2'd2)]={(~s1[(i-(2'd3))/(2'd2)]),ou1};
end
if(((i-(2'd3))/(2'd2))==1'b0) begin
b11[((i-(2'd3))/(2'd2))]=ou1;
end else
b11[(i-(2'd3))/(2'd2)]={1'b1,(~s1[(i-(2'd3))/(2'd2)]),ou1};
end
end
assign outc = b11[0];
endmodule
Debería obtener cinco productos parciales de 12 bits como salidas. Estoy asignando 1 fila de la matriz 2-d a la salida y la estoy comprobando.