|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
以下是一个滤波器和它的testbench文件,请问各位大侠,为什么modelsim做功能仿真的时候,添加激励列表里只显示已经例化的几个乘法器,而x_in,y_out,clk,reset,coeff都找不到呢???
module myfilter(
clk,reset,x_in,y_out,coeff
);
input clk;
input reset;
input [15:0] x_in;
output [15:0] y_out;
input [127:0] coeff;
reg [127:0] x_in_temp;
always@(posedge clk)begin
if (reset)
x_in_temp<=0;
else
x_in_temp[127:0]<={x_in_temp[111:0],x_in};
end
wire [34:0] m0_out,m1_out,m2_out,m3_out,m4_out,m5_out,m6_out,m7_out;
reg [35:0] a0,a1,a2,a3,a4,a5,a6,a7 ;
mult mult_0(
.clken(!reset),
.clock(clk),
.dataa(x_in_temp[15:0]),
.datab(coeff[15:0]),
.result(m0_out)
);
mult mult_1(
.clken(1'b1),
.clock(clk),
.dataa(x_in_temp[31:16]),
.datab(coeff[31:16]),
.result(m1_out)
);
mult mult_2(
.clken(1'b1),
.clock(clk),
.dataa(x_in_temp[47:32]),
.datab(coeff[47:32]),
.result(m2_out)
);
mult mult_3(
.clken(1'b1),
.clock(clk),
.dataa(x_in_temp[63:48]),
.datab(coeff[63:48]),
.result(m3_out)
);
mult mult_4(
.clken(1'b1),
.clock(clk),
.dataa(x_in_temp[79:64]),
.datab(coeff[79:64]),
.result(m4_out)
);
mult mult_5(
.clken(1'b1),
.clock(clk),
.dataa(x_in_temp[95:80]),
.datab(coeff[95:80]),
.result(m5_out)
);
mult mult_6(
.clken(!reset),
.clock(clk),
.dataa(x_in_temp[111:96]),
.datab(coeff[111:96]),
.result(m6_out)
);
mult mult_7(
.clken(!reset),
.clock(clk),
.dataa(x_in_temp[127:112]),
.datab(coeff[127:112]),
.result(m7_out)
);
always @(posedge clk)
begin
a0<=m0_out+a1;
a1<=m1_out+a2;
a2<=m2_out+a3;
a3<=m3_out+a4;
a4<=m4_out+a5;
a5<=m5_out+a6;
a6<=m6_out+a7;
a7<=m7_out;
end
assign y_out=a0[15:0];
endmodule
以下为test文件:
`timescale 1ns/1ns
module tb_myfilter();
reg clk;
reg reset;
reg[15:0] x_in;
reg[127:0] coeff;
wire[15:0] y_out;
myfilter testunit(
.clk(clk),
.reset(reset),
.x_in(x_in),
.y_out(y_out),
.coeff(coeff)
);
initial begin
clk=0;
reset=1;
x_in=0;
coeff=0;
#100;
reset=0;
coeff=128'h0008_0007_0006_0005_0004_0003_0002_0001;
end
always #5 clk=!clk;
always #10 x_in=x_in+1;
endmodule |
|