|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
我用xilinx自带的ISIM仿真,可以正常使用。
但是用modelsim仿真时候,出现'xxx' already declared in this scope (yyy).这样的报警,一般要怎么去解决呢?
出现的错误很多,其中一个如下:
Error: D:/today/modelsimtb/ssram1.v(45): 'clk_125m' already declared in this scope (ssram1).
程序如下(testbench文件未有错误,所以未列出程序,下面只是出错的ssram程序):
- module ssram1(
- // ssram1 interface
- output [3:0]ssram1_bw, // synchronous byte write control
- output s1_BWEn, // byte write enable
- output s1_clk, // clk
- output s1_OEn, // output enable
- output s1_ADSCn, // address status controller
- output s1_CEn, // chip select
- output [18:0]ssram1_addr, // [18:2]acitve address [1:0]synchronous burst address inputs
- inout [31:0]ssram1_data,
- //ctl interface
- input clk_125m,
- input rstn,
- input rd_en,
- input [18:0] rd_addr_in,
- output [31:0] rd_data_out,
- input wr_en,
- input [18:0] wr_addr_in,
- input [31:0] wr_data_in,
- output [4:0]SSRAM_STATE
- );
- /*wire clk_125m;
- wire rstn;
- reg [3:0] ssram1_bw;
- reg s1_BWEn;
- wire s1_clk;
- reg s1_OEn;
- reg s1_ADSCn;
- reg s1_CEn;
- reg [18:0]ssram1_addr;
- (*KEEP = "TRUE"*)wire [31:0]ssram1_data;
- (*KEEP = "TRUE"*)reg [31:0]rd_data_in;
- (*KEEP = "TRUE"*)reg [31:0]rd_data_out;
- reg [4:0]SSRAM_STATE;*/
- assign ssram1_data = (ssram1_bw == 4'b1111)?(wr_data_in):(32'hFFFF_FFFF);
- //assign rd_data_out = (rd_en)?(ssram1_data):(32'hFFFF_FFFF);
- localparam RST = 5'b0_0000,
- RD_1 = 5'b0_0001,
- RD_2 = 5'b0_0010,
- RD_3 = 5'b0_0100,
- WR_1 = 5'b0_1000,
- WR_2 = 5'b1_0000;
-
- assign s1_clk = clk_125m;
- always@(posedge s1_clk or negedge rstn)begin
- if (!rstn) SSRAM_STATE <= RST;
- case(SSRAM_STATE)
- RST:begin
- ssram1_bw <= 0;
- s1_BWEn <= 0;
- s1_OEn <= 0;
- s1_ADSCn <= 0;
- s1_CEn <= 0;
- ssram1_addr <= 0;
- //ssram1_data<= 32'hFFFF_FFFF;
- if (rd_en) SSRAM_STATE <= RD_1;
- else if (wr_en) SSRAM_STATE <= WR_1;
- else SSRAM_STATE <= RST;
- end
- RD_1:begin
- s1_ADSCn <= 1;
- s1_BWEn <= 1;
- s1_OEn <= 0;
- s1_CEn <= 0;
- ssram1_bw <= 0;
- ssram1_addr <= rd_addr_in;
- SSRAM_STATE <= RD_2;
- end
- RD_2:begin
- SSRAM_STATE <= RD_3;
- end
- RD_3:begin
- rd_data_out <= ssram1_data;
- SSRAM_STATE <= RST;
- end
- WR_1:begin
- s1_CEn <=0;
- ssram1_addr <= wr_addr_in;
- SSRAM_STATE <= WR_2;
- end
- WR_2:begin
- s1_ADSCn <= 1;
- s1_BWEn <= 0;
- s1_OEn <= 1;
- ssram1_bw <= 4'b1111;
- SSRAM_STATE <= RST;
- end
- endcase
- end
- endmodule
复制代码 |
|