|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
这个是利用块RAM实现a、b两路数据延迟,数据位宽都为32,其中a路延迟16个数据周期,b路延迟8个数据周期,代码如下:
- `timescale 1ns / 1ps
- //////////////////////////////////////////////////////////////////////////////////
- // Company:
- // Engineer:
- //
- // Create Date: 20:51:45 12/15/2013
- // Design Name:
- // Module Name: bram_delay
- // Project Name:
- // Target Devices:
- // Tool versions:
- // Description:
- //
- // Dependencies:
- //
- // Revision:
- // Revision 0.01 - File Created
- // Additional Comments:
- //
- //////////////////////////////////////////////////////////////////////////////////
- module bram_delay(
- input wire clk,
- input wire rst_n,
- input wire[31:0] a_in,
- input wire[31:0] b_in,
- output reg[31:0] a_delay,
- output reg[31:0] b_delay);
- /*************************************************************************/
- parameter DEL = 1;
- /*************************************************************************/
- wire[5:0] a_addr;
- wire[5:0] b_addr;
- wire[31:0] douta;
- wire[31:0] doutb;
- reg[5:0] a_addr1 = 6'd0;
- reg[5:0] a_addr2 = 6'd0;
- reg[5:0] b_addr1 = 6'd32;
- reg[5:0] b_addr2 = 6'd32;
- reg wea = 1'b0;
- reg web = 1'b0;
- reg flag = 1'b0;
-
- /**************************************************************************/
- always @ ( posedge clk)
- begin
- if( rst_n == 1'b0 )
- begin
- a_delay <= 32'b0;
- b_delay <= 32'b0;
- end
- else begin
- flag <= #DEL !flag;
- if( flag == 1'b1)
- begin
- a_delay <= #DEL a_delay;
- b_delay <= #DEL b_delay;
- wea <= #DEL 1'b1;
- web <= #DEL 1'b1;
- a_addr2 <= #DEL a_addr2;
- b_addr2 <= #DEL b_addr2;
- if( a_addr1 == 6'd31)
- a_addr1 <= #DEL 6'd0;
- else
- a_addr1 <= #DEL a_addr1 + 6'b1;
- if( b_addr1 == 6'd63)
- b_addr1 <= #DEL 6'd0;
- else
- b_addr1 <= #DEL b_addr1 + 6'b1;
- end
- else
- begin
- a_delay <= #DEL douta;
- b_delay <= #DEL doutb;
- wea <= #DEL 1'b0;
- web <= #DEL 1'b0;
- a_addr1 <= #DEL a_addr1;
- b_addr1 <= #DEL b_addr1;
- if( a_addr1 <= 6'd15)
- a_addr2 <= #DEL a_addr1 + 6'd16;
- else
- a_addr2 <= #DEL a_addr1 - 6'd16;
- if( b_addr1 <= 6'd39)
- b_addr2 <= #DEL b_addr1 + 6'd24;
- else
- b_addr2 <= #DEL b_addr1 - 6'd8;
- end
- end
- end
- /*************************************************************************/
- assign a_addr = !flag ? a_addr1 : a_addr2;
- assign b_addr = !flag ? b_addr1 : b_addr2;
- /**************************************************************************/
- bram_16 dut (
- .clka(clk), // input clka
- .wea(wea), // input [0 : 0] wea
- .addra(a_addr), // input [5 : 0] addra
- .dina(a_in), // input [15 : 0] dina
- .douta(douta), // output [15 : 0] douta
- .clkb(clk), // input clkb
- .web(web), // input [0 : 0] web
- .addrb(b_addr), // input [5 : 0] addrb
- .dinb(b_in), // input [15 : 0] dinb
- .doutb(doutb) // output [15 : 0] doutb
- );
- endmodule
复制代码
这个程序功能能够实现,仿真结果也正确,但是却出现瑕疵,综合出现结果如下:
- WARNING:Xst:916 - "bram_delay.v" line 52: Delay is ignored for synthesis.
- WARNING:Xst:916 - "bram_delay.v" line 55: Delay is ignored for synthesis.
- WARNING:Xst:916 - "bram_delay.v" line 56: Delay is ignored for synthesis.
- WARNING:Xst:916 - "bram_delay.v" line 57: Delay is ignored for synthesis.
- WARNING:Xst:916 - "bram_delay.v" line 58: Delay is ignored for synthesis.
- WARNING:Xst:915 - Message (916) is reported only 5 times for each module.
- WARNING:Xst:2211 - "ipcore_dir/bram_16.v" line 94: Instantiating black box module <bram_16>.
- WARNING:Xst:647 - Input <b_in<31:16>> is never used. This port will be preserved and left unconnected if it belongs to a top-level block or it belongs to a sub-block and the hierarchy of this sub-block is preserved.
- WARNING:Xst:647 - Input <a_in<31:16>> is never used. This port will be preserved and left unconnected if it belongs to a top-level block or it belongs to a sub-block and the hierarchy of this sub-block is preserved.
- WARNING:Xst:1710 - FF/Latch <b_delay_31> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_30> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_29> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_28> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_27> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_26> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_25> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_24> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_23> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_22> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_21> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_20> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_19> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_18> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_17> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <b_delay_16> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_31> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_30> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_29> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_28> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_27> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_26> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_25> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_24> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_23> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_22> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_21> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_20> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_19> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_18> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_17> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <a_delay_16> (without init value) has a constant value of 0 in block <bram_delay>. This FF/Latch will be trimmed during the optimization process.
- WARNING:Xst:2404 - FFs/Latches <b_delay<31:16>> (without init value) have a constant value of 0 in block <bram_delay>.
- WARNING:Xst:2404 - FFs/Latches <a_delay<31:16>> (without init value) have a constant value of 0 in block <bram_delay>.
复制代码
对于a_delay和b_delay都已经初始化了的,为什么还出现这个问题?仿真图如下:
望各位坛友支支招,在此谢谢了!! |
|