`timescale 1 ps/ 1 ps
module pipeline_booth_multiplier_t()
reg [7:0] A
reg [7:0] B
reg CLK
reg RSTn
wire [15:0] Product
initial
begin
RSTn = 1'b0#10 RSTn = 1'b1
CLK = 1'b1forever # 10 CLK = ~CLK
end
pipeline_booth_multiplier i1 (
.A(A),
.B(B),
.CLK(CLK),
.Product(Product),
.RSTn(RSTn)
)
reg [3:0]i
always @ ( posedge CLK or negedge RSTn )
if( !RSTn )
begin
i <= 4'd0
A <= 8'd0
B <= 8'd0
end
else
case( i )
0:
begin A <= 8'd127B <= 8'd127i <= i + 1'b1end
1:
begin A <= -8'd127B <= 8'd127i <= i + 1'b1end
2:
begin A <= 8'd20B <= 8'd12i <= i + 1'b1end
3:
begin A <= -8'd5B <= 8'd42i <= i + 1'b1end
4:
begin A <= 8'd54B <= 8'd36i <= i + 1'b1end
5:
begin A <= -8'd31B <= -8'd12i <= i + 1'b1end
6:
begin A <= -8'd127B <= -8'd127i <= i + 1'b1end
7:
begin A <= 8'd0B <= 8'd0i <= 4'd7end
endcase
endmodule
一个设计是有输入输出端口的,比如一块芯片,当然你的设计最终也可以做成芯片那么只有输入信号给对的情况下,才能获取你 想要的输出,这个用来给你输入端口提供信号的就是仿真激励文件(举个例子,你设计了一个加法器 Y=a+b,那么a,b就是你的输入信号,怎么 验证你的设计是对的呢,给个激励文件:a=1 ,b =3,此时看Y是不是等于4,如果是就证明你设计是对的)
这个给输入 信号具体值的文件就是激励文件,激励文件可以不要求可综合,所以写起来很方便!
啰嗦了一大堆,希望可以对你有点帮助!
你的testbench有问题
没有加激励
你把这段话改成我后面的那段
init : PROCESS
-- variable declarations
BEGIN
-- code that executes only once
WAIT
END PROCESS init
always : PROCESS
-- optional sensitivity list
-- ( )
-- variable declarations
BEGIN
-- code executes for every event on sensitivity list
WAIT
END PROCESS always
下面是添加的clk和激励:
CLK_process :process
begin
CLK <= '0'
wait for 10 ns
CLK <= '1'
wait for 10 ns
end process
stim_proc: process
begin
wait for 20 ns
EN <='1'
RST <= '1'
wait for 10 ns
RST <= '0'
wait
end process
我试过可以完美仿真,顺便贴张仿真结果给你吧:)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)