赞
踩
目录
FIFO(First input First Output) ,即先入先出,本质上是一个RAM,FIOF和RAM的共同点在于都是能储存数据,都有控制读和写的信号,不同点在于FIOF没有地址,因此不能任意指定读取某个数据,数据只能按照数据输入的顺序输出,且读写可以同时进行。
如果将数据把fifo的深度写满,数据将不能在进去,也不会覆盖原来的数据,读取fifo的数据也只能读一遍,读完一遍fifo就空了,需要再往fifo写数据才能读出新的数据,否则读出的数据一直是最后一次读fifo时的数据。
FIFO的类型区分主要根据FIFO在实现时利用的是芯片中的哪些资源,其分类主要有以下四种:
shift register FIFO:通过寄存器来实现的,由于片内FF资源比较珍贵,所以这种方式的fifo要考虑周全后使用。
built-in FIFO:这种类型的FIFO只有7系列之后(包括UltraScale)才有。是一种集成的FIFO硬核,他不支持almost_full标志
Block Ram FIFO:通过块RAM的资源配置形成的FIFO,其本质是Block RAM+一些外设电路。
Distributed Ram FIFO:通过分布式RAM配置形成的FIFO,与BRAM类似,只是RAM的类型不一样。
列部分常使用的端口
信号名 | 位宽 | 说明 | 端口 |
wr_clk | 1 | 写时钟,提供给写端口使用的时钟 | input |
wr_en | 1 | 写使能,高电平有效,在每个写时钟上升沿被捕捉,捕捉一次写入一次数据 | input |
full | 1 | 满信号,高有效 在FIFO内部写数据个数 = FIFO写深度的第一个时钟上升沿置高,在FIFO内部写数据个数 < FIFO写深度的第一个时钟上升沿拉低。 在full有效时,FIFO会关闭写功能,如果此时wr_en有效,full会置高overflow即输出满溢信号,FIFO中的数据没有变化,往满FIFO中写不会覆盖之前的数据。 | output |
din[N:0] | 1~1024 | 写入的数据,当wr_en高被捕捉时,din被写入到FIFO中 | input |
almost_full | 1 | 预满信号,高有效 在FIFO内部写数据个数 = FIFO深度 - 1的第一个写时钟上升沿置高, 在FIFO内部写数据个数 < FIFO深度 - 1的第一个写时钟上升沿拉低 output wr_rst 1 写复位,高有效, 在写复位信号有效后的第一个写时钟上升沿,FIFO被清空,并不再响应写使能, 直到写复位信号失效后下一个写时钟上升沿(包括)开始再去响应写使能 | input |
rd_clk | 1 | 读时钟 对于同步FIFO,FIFO读写时钟合一 对于异步FIFO,FIFO会有分开的写时钟和读时钟 | input |
rd_en | 1 | 读使能,高有效,在每个读时钟上升沿被捕捉,捕捉一次读出一次数据 | input |
empty | 1 | 空信号,高有效, 在FIFO内部读数据个数 = 0的第一个读时钟上升沿置高, 直到FIFO内部读数据个数 > 0的第一个读时钟上升沿拉低。 在empty有效时,FIFO会关闭读功能,如果此时rd_en有效,FIFO会置高underflow即输出空溢信号,FIFO内部的数据没有变化,读取空FIFO不是破坏性的。 | output |
dout | 可设定位宽 = din位宽 *(1/8,1/4,1/2,1,2,4,8) | 读数据,读数据位宽 * 读深度 = FIFO容量 = 写数据位宽 * 写深度, 对于FWFT FIFO,dout预先有效,在读使能被捕捉的同时更新下一个读数据, 对于Standard FIFO,在读使能被捕捉的时钟过后的第二个时钟上升沿,dout才是读出的数据 | output |
almost_empty | 1 | 预空信号,高有效 在FIFO内部读数据个数 = 1的第一个读时钟上升沿置高, 在FIFO内部读数据个数 > 1的第一个读时钟上升沿被拉低 | output |
参考链接:https://blog.csdn.net/weixin_42837669/article/details/121734888
在FPGA配置完成后,读写操作开始之前,FIFO必须被复位,有同步/异步两种复位可用。
Xilinx建议,不要通过改变clk来改变FIFO的读写行为,而应该去控制读写使能信号,当时钟未稳定时,不要去操作FIFO,当时钟稳定后,先对FIFO进行复位,然后再去操作FIFO。
虽然写满和读空行为都不是破坏性的,但仍然强烈建议不要在FIFO满时置高写使能,不要在FIFO空时置高读使能。也就是wr_en的用户逻辑需要考虑full信号,rd_en的用户逻辑需要考虑empty信号。
写数据只有在din输入同时wr_ack被拉高(在被写入成功的下一个时钟上升沿拉高)时才写入到FIFO中。这里wr_ack是对数据接收的应答,断言时表示接收成功。当然也可以不使能wr_ack,只是wr_ack的存在会让数据的写入更加安全。
almost_full在fifo只能再写入一个数据时被拉高(full前一拍),当fifo写满时,如果wr_en仍为高,则溢出信号overflow在一个时钟上升沿被拉高,需要注意的一个关键点是,FIFO被写满时,即使再输入数据,写入请求还是会被忽略的,FIFO中的数据保持不变
在FIFO被写满时,如果开始读操作,full信号会被拉低,此时数据又可以再次写入FIFO。
当read使能且FIFO不是空的时候,数据开始从FIFO读出。同时valid信号被断言表示数据有效。读操作只有在FIFO有数据时才能成功,当FIFO是空的时,此时读信号会被忽略,同时underflow会被拉高表示下溢,数据输出不会发生任何变化
读操作分为Standard Read 和First_Word Fall_Through 两种模式,
First_Word Fall_Through模式广泛的用于数据缓冲应用,其特点是相对读使能0延迟输出读数据,它的原理是第一个数据不需要读使能就能自动呈现在读端口
Standard Read模式用于输出端时序特性要求比较高的场合,特点是相对读使能输出1拍延迟,也可以时钟多拍延迟这样经过寄存器的打拍提高输出寄存器间的时序特性
当读操作和写操作同时发生在empty置高时,写操作可以正常执行,读操作会被忽略,在下个时钟,empty和underflow被拉低后,才能继续进行读操作。
标准读模式下,当empty为低时,表示FIFO中有数据可读。此时使能rd_en,在下个时钟上升沿即开始读取数据,同时valid被拉高表示读取数据有效。当读到FIFO只剩一个数据时,almost_empty被拉高;当读完所有数据时,empty拉高。此时如果再进行读取,则underflow被拉高言,表示下溢,同时valid拉低表示数据无效。
在FWFT模式下,数据总是能被提前获取的,可以这么理解,在我们还不需要读取FIFO的数据的时候,其实我们不在乎FIFO中第一个数据是什么,但FWFT模式下,第一个数据提前进入了准备发送的状态,即我们可以dout处看到即将输出的数据是什么,而当我们开始读的时候,下一个数据就进入准备状态,也被我们提前获取了。
比较两种模式下的flag信号。almost_empty是在FIFO中还剩下一个数据是被拉高,empty是在把最后一个数据读取完了之后被拉高。在SR模式下,empty是在把最后一个数据读出来的同时拉高,在FWFT模式下,empty是在获取最后一个数据后才拉高,因为我们是提前知道最后一个数据,此时的数据还是停留在FIFO中,只有把它读出来了,FIFO才是空的,empty才会被拉高。underflow都在读空之后还试图继续读取的时候才会拉高,所以underflow总是比empty慢一拍。valid总是和数据是同步的。
数据位宽转换:
比如我们有32bit的数据需要转换成128bit或者32bit的数据需要转换成8bit,那么用FIFO来转换也是非常方便的。
跨时钟域的应用:
比如数据是2个不同步的时钟,那么我们就可以用FIFO实现跨时钟域的传输
写一个输入的数据是86X86的矩阵,数据由串口传输过来,传过来的数据先一行一行的用fifo缓存,然后每三行的同一列进行一次相加。
1、 由于是三行数据的相加,故可将第0行和第一行数据分别存放在fifo1和fifo2中,当第三行数据来临时,将fifo1,fifo2,以及rx_data上的数据相加即可。
2、第0、1、2行加完后,需要把1、2、3行相加,所以在前一次相加的时候要将1、 2行数据存放到fifo里,即相加的同事要将fifo2的数据存入fifo1中,
3、 最后三行相加的时候,最后一行不需要存到fifo2中,最后两行不要存放到fifo1中,因此fifo1中要存入的数据位0~83行的数据,fifo2中要存放的数据位1~84行的数据,需要进行的加运算次数位84x86次。
端口传输方向 | 端口名称 | 位宽 | 说明 |
input | clk | 1 | 系统时钟50 |
input | rst_n | 1 | 复位信号 |
input | rx_data | 8 | rx传送过来的86x86数据 |
input | pi_flag | 1 | 标志威高表示rx_data有效 |
output | po_sum | 8 | 三行数据相加的和,传给tx |
output | po_flag | 1 | 标志高表示po_sum输出有效传送给tx |
中间变量 | cnt_col | 7 | 列计数器,pi_flag为1时加一 |
中间变量 | cnt_row | 7 | 行计数器 |
中间变量 | data_in2 | 8 | 存入fifo2中的数据 |
中间变量 | wr_en2 | 1 | fifo2写请求 |
中间变量 | rd_en | 1 | fifo1,fifo2 读请求 |
中间变量 | dout1/2 | 8 | 两个fifo输出信号,当rd_en为1时下一拍输出 |
中间变量 | wr_en1_pre1 | 1 | fifo1写请求提前一拍 |
中间变量 | wr_en1_pre2 | 1 | fifo1写请求提前两拍 |
中间变量 | wr_en1 | 1 | fifo1写请求 |
-
- // ----------------------------------------------------------
- // Copyright (c) 2014-2022 All rights reserved
- // ----------------------------------------------------------
- // Author : yongchan jeon (Kris) poucotm@gmail.com
- // File : double_fifo_ctrl.v
- // Create : 2022-08-23 14:55:13
- // Revise : 2022-08-23 14:55:13
- // Editor : sublime text3, tab size (4)
- // --------------------------------------------------------
- module double_fifo_ctrl(
- input wire clk,
- input wire rst_n,
- input wire pi_flag,
- input wire [7:0] pi_data,
-
- output reg po_flag,
- output reg [7:0] po_sum //8bit+8bit=8bit
-
- );
-
- reg wr_en1,wr_en2;
- reg [6:0] cnt_col,cnt_row;
- reg wr_en1_pre1,wr_en1_pre2;
- reg rd_en;
- reg [7:0] data_in1,data_in2;
- reg add_flag;
-
- wire [7:0] dout1,dout2;
- wire full1,empty1,full2,empty2;
-
- //wr_en1
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- wr_en1 <= 1'b0;
- else if (cnt_row == 'd0)begin
- if( pi_flag == 1'b1)
- wr_en1 <= 1'b1;
- else
- wr_en1 <= 1'b0;
- end
- else
- wr_en1 <= wr_en1_pre1;
-
-
- //wr_en1_pre2
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- wr_en1_pre2 <= 1'b0;
- else if (cnt_row >= 'd2 && cnt_row <='d84 && pi_flag == 1'b1) // else if (cnt_row >= 'd2 && cnt_row <= 'd84)
- wr_en1_pre2 <= 1'b1; // wr_en1_pre2 <= pi_flag;
- else //
- wr_en1_pre2 <= 1'b0;
- //wr_en1_pre1
- always@(posedge clk )
- wr_en1_pre1 <= wr_en1_pre2;
- //rd_en
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- rd_en <= 1'b0;
- else if (cnt_row >= 'd2 && cnt_row <= 'd845 && pi_flag == 1'b1)//(cnt_row >= 'd2 && cnt_row <= 'd84 && pi_flag == 1'b1)少记一个cnt_row,到最后输出结果少了
- rd_en <= 1'b1;
- else
- rd_en <= 1'b0;
- //data_in1
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- data_in1 <= 'd0;
- else if (cnt_row == 'd0)
- data_in1 <= pi_data;
- else //else if (cnt_row >= 'd2 && cnt_row <= 'd84)
- data_in1 <= dout1; //data_in1 <= dout1;
-
-
- //wr_en2
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- wr_en2 <= 1'b0;
- else if (cnt_row >= 'd1 && cnt_row <= 'd84 && pi_flag == 1'b1)
- wr_en2 <= 1'b1;
- else
- wr_en2 <= 1'b0;
- //data_in2
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- data_in2 <= 'd0;
- else if (cnt_row >= 'd1 && cnt_row <= 'd84)
- data_in2 <= pi_data;
- //add_flag
- always@(posedge clk)
- add_flag <= rd_en;
- //po_sum
- always@(posedge clk)
- if(add_flag == 1'b1)
- po_sum <= dout1 + dout2 + pi_data;
-
-
- //po_flag
- always@(posedge clk)
- po_flag <=add_flag;
-
-
- //cnt_col
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- cnt_col <= 7'd0;
- else if (pi_flag == 1'b1 && cnt_col == 85)
- cnt_col <= 7'd0;
- else if (pi_flag == 1'b1 && cnt_col != 85)
- cnt_col <= cnt_col + 1'b1;
-
-
- //cnt_row
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- cnt_row <= 7'd0;
- else if(pi_flag == 1'b1 && cnt_col == 85 && cnt_row == 85)
- cnt_row <= 'd0;
- else if (pi_flag == 1'b1 && cnt_col == 85)
- cnt_row <= cnt_row + 1'b1;
-
-
-
-
- sfifo_wr128x8 u_fifo1 (
- .clk(clk), // input clk
- .din(data_in1), // input [7 : 0] din
- .wr_en(wr_en1), // input wr_en
- .rd_en(rd_en), // input rd_en
- .dout(dout1), // output [7 : 0] dout
- .full(full1), // output full full、empty信号没有使用
- .empty(empty1) // output empty full、empty信号没有使用
- );
-
- sfifo_wr128x8 u_fifo2 (
- .clk(clk), // input clk
- .din(data_in2), // input [7 : 0] din
- .wr_en(wr_en2), // input wr_en
- .rd_en(rd_en), // input rd_en
- .dout(dout2), // output [7 : 0] dout
- .full(full2), // output full
- .empty(empty2) // output empty
- );
-
-
- wire [35:0] CONTROL0;
- wire [50:0] TRIG0;
-
- assign TRIG0 = {
- po_sum,
- pi_flag,
- empty2,
- empty1,
- rd_en,
- cnt_col,
- cnt_row,
- add_flag,
- pi_data,
- dout1,
- dout2
-
- };
-
-
- cs_icon icon_inst (
- .CONTROL0(CONTROL0) // INOUT BUS [35:0]
- );
-
- cs_ila ila_inst (
- .CONTROL(CONTROL0), // INOUT BUS [35:0]
- .CLK(clk), // IN
- .TRIG0(TRIG0) // IN BUS [50:0]
- );
- endmodule
-
- // ----------------------------------------------------------
- // Copyright (c) 2014-2022 All rights reserved
- // ----------------------------------------------------------
- // Author : yongchan jeon (Kris) poucotm@gmail.com
- // File : urat_rx.v
- // Create : 2022-08-15 15:16:15
- // Revise : 2022-08-26 13:11:28
- // Editor : sublime text3, tab size (4)
- // ----------------------------------------------------------
- module uart_rx (
- input wire clk,
- input wire rst_n,
- input wire rx,
-
- output reg po_flag,
- output reg [7:0] po_data
-
- );
-
- parameter BUAD_CNT_MAX = 5207;
- parameter BUAD_HALFCNT_MAX = 2603;
-
- reg rx_1;
- reg rx_2;
- reg reg_rx2;
- reg rx_flag;
- reg [3:0] bit_cnt;
- reg bit_flag;
- reg [12:0] buad_cnt;
-
- //rx_1 <= rx
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- rx_1<= 'd1;
- else
- rx_1 <= rx;
-
- //rx_2 <= rx_1
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- rx_2<= 'd1;
- else
- rx_2 <= rx_1;
-
- //reg_rx <= rx_2
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- reg_rx2<= 'd1;
- else
- reg_rx2 <= rx_2;
-
- //rx_flag
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- rx_flag <= 1'b0;
- else if((!rx_2 && reg_rx2) == 1'b1)
- rx_flag <= 1'b1;
- else if(bit_cnt ==4'd8 && bit_flag == 1'b1)
- rx_flag <= 1'b0;
- //buad_cnt
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- buad_cnt <= 13'd0;
- else if (buad_cnt == BUAD_CNT_MAX)
- buad_cnt <= 13'd0;
- else if (bit_cnt == 4'd8 && bit_flag == 1'b1)
- buad_cnt <= 13'd0;
- else if(rx_flag == 1'b1)
- buad_cnt <= buad_cnt + 1'b1;
- //bit_flag
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- bit_flag <= 1'b0;
- else if(buad_cnt == BUAD_HALFCNT_MAX)
- bit_flag <= 1'b1;
- else
- bit_flag <= 1'b0;
- //bit_cnt
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- bit_cnt <= 4'd0;
- else if (bit_cnt == 8 && bit_flag == 1'b1)
- bit_cnt <= 4'd0;
- else if(bit_flag == 1'b1)
- bit_cnt <= bit_cnt + 1'b1;
- //po_data
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- po_data <= 8'd0;
- else if (bit_cnt >= 1 && bit_flag == 1'b1)
- po_data <= {rx_2,po_data[7:1]};
-
- //po_flag
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- po_flag <= 1'b0;
- else if(bit_cnt == 8 && bit_flag == 1'b1)
- po_flag <= 1'b1;
- else
- po_flag <= 1'b0;
- endmodule
uart_tx
-
- // ----------------------------------------------------------
- // Copyright (c) 2014-2022 All rights reserved
- // ----------------------------------------------------------
- // Author : yongchan jeon (Kris) poucotm@gmail.com
- // File : urat_tx.v
- // Create : 2022-08-15 16:07:47
- // Revise : 2022-08-26 13:11:12
- // Editor : sublime text3, tab size (4)
- // ----------------------------------------------------------
- module uart_tx(
- input wire clk,
- input wire rst_n,
- input wire [7:0] pi_data,
- input wire pi_flag,
-
- output reg tx
-
- );
-
- parameter BUAD_CNT_MAX = 5207;
-
- reg [7:0] reg_data;
- reg tx_flag;
- reg [3:0] bit_cnt;
- reg bit_flag;
- reg [12:0] buad_cnt;
-
-
- //reg_data <= pi_data
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- reg_data <= 8'd0;
- else if(pi_flag == 1'b1)
- reg_data <= pi_data;
- //tx_flag
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- tx_flag <= 1'b0;
- else if(pi_flag == 1'b1)
- tx_flag <= 1'b1;
- else if (bit_cnt == 4'd8 && bit_flag == 1'b1)
- tx_flag <= 1'b0;
-
- //buad_cnt
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- buad_cnt <= 13'd0;
- else if (buad_cnt == BUAD_CNT_MAX)
- buad_cnt <= 13'd0;
- else if(tx_flag == 1'b1)
- buad_cnt <= buad_cnt + 1'b1;
- //bit_flag
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- bit_flag <= 1'b0;
- else if(buad_cnt == BUAD_CNT_MAX-1)
- bit_flag <= 1'b1;
- else
- bit_flag <= 1'b0;
- //bit_cnt
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- bit_cnt <= 4'd0;
- else if (bit_cnt == 8 && bit_flag == 1'b1)
- bit_cnt <= 4'd0;
- else if(bit_flag == 1'b1)
- bit_cnt <= bit_cnt + 1'b1;
- //tx
- always@(posedge clk or negedge rst_n)
- if(rst_n == 1'b0)
- tx <= 1'd1;
- else if(pi_flag == 1'b1)
- tx <= 1'd0;
- else if(bit_cnt <= 4'd7 && bit_flag == 1'b1)
- tx <= reg_data[bit_cnt];
- else if(bit_cnt == 4'd8 && bit_flag == 1'b1)
- tx <= 1'b1;
- endmodule
-
- // ----------------------------------------------------------
- // Copyright (c) 2014-2022 All rights reserved
- // ----------------------------------------------------------
- // Author : yongchan jeon (Kris) poucotm@gmail.com
- // File : top_fifo.v
- // Create : 2022-08-24 07:52:07
- // Revise : 2022-08-24 07:52:07
- // Editor : sublime text3, tab size (4)
- // ---------------------------------------------------------
- module top_fifo(
-
- input wire clk,
- input wire rst_n,
- input wire rx,
-
- output wire tx
- );
-
- wire pi_flag;
- wire [7:0] pi_data;
-
- wire [7:0] po_data1;
- wire po_flag1;
-
- uart_tx inst_uart_tx (
- .clk (clk),
- .rst_n (rst_n),
- .pi_data (po_data1),
- .pi_flag (po_flag1),
- .tx (tx)
- );
-
- uart_rx inst_uart_rx (
- .clk (clk),
- .rst_n (rst_n),
- .rx (rx),
- .po_flag (pi_flag),
- .po_data (pi_data)
- );
-
- double_fifo_ctrl inst_double_fifo_ctrl(
- .clk (clk),
- .rst_n (rst_n),
- .pi_flag (pi_flag),
- .pi_data (pi_data),
- .po_flag (po_flag1),
- .po_sum (po_data1)
- );
-
-
- endmodule
-
- // ----------------------------------------------------------
- // Copyright (c) 2014-2022 All rights reserved
- // ----------------------------------------------------------
- // Author : yongchan jeon (Kris) poucotm@gmail.com
- // File : top_fifo.v
- // Create : 2022-08-24 07:52:07
- // Revise : 2022-08-24 07:52:07
- // Editor : sublime text3, tab size (4)
- // ---------------------------------------------------------------
- `timescale 1ns / 1ps
- module tb_top_fifo;
-
- // Inputs
- reg clk;
- reg rst_n;
- reg rx;
-
- reg [7:0] mem[85:0];
-
- // Outputs
- wire tx;
-
- // Instantiate the Unit Under Test (UUT)
- top_fifo uut (
- .clk(clk),
- .rst_n(rst_n),
- .rx(rx),
- .tx(tx)
- );
-
- initial begin
- // Initialize Inputs
- sclk = 0;
- rst_n = 0;
- rx = 1;
-
- // Wait 100 ns for global reset to finish
- #100;
- rst_n =1;
- // Add stimulus here
-
- end
-
- initial begin
- $readmemb("./data.txt",mem);
- end
-
- always #10 clk = ~clk;
-
- initial begin
- #200;
- rx_byte();
- end
-
- task rx_byte();
- integer i;
- integer j;
- begin
- for(j=0;j<86;j=j+1)begin
- for (i=0;i<86;i=i+1)begin
- rx_bit(mem[i]);
- end
- end
- end
- endtask
-
-
- task rx_bit(input [7:0] data);
- integer i;
- begin
- for(i=0;i<10;i=i+1) begin
- case (i)
- 0:rx =0;
- 1:rx =data[i-1];
- 2:rx =data[i-1];
- 3:rx =data[i-1];
- 4:rx =data[i-1];
- 5:rx =data[i-1];
- 6:rx =data[i-1];
- 7:rx =data[i-1];
- 8:rx =data[i-1];
- 9:rx =1;
- endcase
- #104160;
- end
- end
- endtask
- endmodule
-
- 0000000
- 0000001
- 0000010
- 0000011
- 0000100
- 0000101
- 0000110
- 0000111
- 0001000
- 0001001
- 0001010
- 0001011
- 0001100
- 0001101
- 0001110
- 0001111
- 0010000
- 0010001
- 0010010
- 0010011
- 0010100
- 0010101
- 0010110
- 0010111
- 0011000
- 0011001
- 0011010
- 0011011
- 0011100
- 0011101
- 0011110
- 0011111
- 0100000
- 0100001
- 0100010
- 0100011
- 0100100
- 0100101
- 0100110
- 0100111
- 0101000
- 0101001
- 0101010
- 0101011
- 0101100
- 0101101
- 0101110
- 0101111
- 0110000
- 0110001
- 0110010
- 0110011
- 0110100
- 0110101
- 0110110
- 0110111
- 0111000
- 0111001
- 0111010
- 0111011
- 0111100
- 0111101
- 0111110
- 0111111
- 1000000
- 1000001
- 1000010
- 1000011
- 1000100
- 1000101
- 1000110
- 1000111
- 1001000
- 1001001
- 1001010
- 1001011
- 1001100
- 1001101
- 1001110
- 1001111
- 1010000
- 1010001
- 1010010
- 1010011
- 1010100
- 1010101
由于仿真时间较长,对后面的数据抓取比较久,故这里用chipsope pro调试工具进行抓取,本次采用调用ip核打方式进行信号的添加(仅用modelsim仿真的要在double_fifo_ctrl中将icon和ila 的IP核的例化,以及信号的提取代码删除)
icon、ila例化以及要抓取信号代码:
- wire [35:0] CONTROL0;
- wire [50:0] TRIG0;
-
- assign TRIG0 = {
- po_sum,
- pi_flag,
- empty2,
- empty1,
- rd_en,
- cnt_col,
- cnt_row,
- add_flag,
- pi_data,
- dout1,
- dout2
-
- };
-
-
- cs_icon icon_inst (
- .CONTROL0(CONTROL0) // INOUT BUS [35:0]
- );
-
- cs_ila ila_inst (
- .CONTROL(CONTROL0), // INOUT BUS [35:0]
- .CLK(clk), // IN
- .TRIG0(TRIG0) // IN BUS [50:0]
- );
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。