I'm writing code in Verilog that takes A
and B
as 8-bit inputs and multiplies them using the radix-4 method.
When I execute the code, the shft
output appears as "xx0", and mutipler
can't take the value of the input A.
Can any one help me with that?
This is the sub-code:
module pha1 (A, B, M ,clk, shft);
input wire [7:0] A, B;
input clk;
output reg [7:0] M;
reg [7:0] mutipler;
output reg[2:0] shft;
reg init;
initial
init=1'b0;
initial
mutipler=A;
always @(posedge clk)
begin
shft = {mutipler[1], mutipler[0], init};
end
endmodule
This is the testbench :
`timescale 1ns / 1ps
module pah1tst;
reg [7:0] A;
reg [7:0] B;
reg clk;
wire [9:0] M;
wire [2:0] shft;
pha1 uut (
.A(A),
.B(B),
.M(M),
.clk(clk),
.shft
);
initial clk = 0;
always #2 clk = ~clk;
initial begin
A = 2;
B = 5;
#5;
#34;
end
endmodule