|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
最近在用Xilinx IP核实现CORDIC的仿真。 我用的仿真平台是ISE10.1 选择的芯片是Virtex-4 SX55T。下面是我的程序和测试程序:
module My_Arctan(
input clk,
input rst_n,
input [15:0] d_real,
input [15:0] d_imag,
input data_en,
output [15:0] phase_out,
output rdy
);
Arctan UArctan(
.clk(clk),
.x_in(d_real),
.y_in(d_imag),
.ce(data_en),
.phase_out(phase_out),
.rdy(rdy)
);
endmodule
///-----------------------test bench----
`timescale 1ns/1ps
module My_Arctan_tb;
//input
reg clk;
reg rst_n;
reg [15:0] d_real,d_imag;
reg data_en;
//output
wire [15:0] phase_out;
wire rdy;
//---Instantiate the Unit Under Test (UUT)
My_Arctan UUT(
.clk(clk),
.rst_n(rst_n),
.d_real(d_real),
.d_imag(d_imag),
.data_en(data_en),
,phase_out(phase_out),
.rdy(rdy)
);
//----clock
always #10 clk = ~clk;
initial begin
clk = 0;
rst_n = 0;
d_imag = 0;
d_real = 0;
data_en = 0;
#200 rst_n = 1;
end
reg [2:0] cnt_8;
always @(posedge clk or negedge rst_n)
begin
if(!rst_n)
cnt_8 <= 3'd0;
else
cnt_8 <=cnt_8 +3'd1;
end
always @(posedge clk or negedge rst_n)
begin
if(!rst_n)
data_en<=1'b0;
else if(cnt_8 == 3'd7)
data_en<=1'b1;
else
data_en<=1'b0;
end
always @(posedge clk or negedge rst_n)
begin
if(!rst_n)
begin
d_real<=16'd0;
d_imag<=16'd0;
end
else if(cnt_8 ==3'd7)
begin
d_real<=$random%32768;
d_imag<=$random%32768;
end
else
begin
d_real<=d_real;
d_imag<=d_imag;
end
end
endmodule
////////////////////////////////////////////////////////////
这个模块前仿没有问题,结果是正确的。但是后仿时,Modelsim 就报错了,错误信息如下:
#**Error:C:/Modeltech_6.2b/Xilinx/Simprims_ver/Simprims_ver_source.v[17637]setup(negedge CE &&& (ce_clk_enable1 == 1):864125 ps, posedge CLK: 864420 ps , 440 ps);
# TimeL864420 ps Iteration:0 instance :/My_Arctan_tb/UUT/\UArctan/BU740\
......
上述错误一直出现。信号phase_out是X态。
哪位大侠做过这方面的设计,能否帮小弟解决一下。不胜感激。 |
|