如果fifo中没有数据,且有输入,则是bypass fifo,同周期内直接把输入数据转到输出数据。如果fifo中有数据,则读取fifo,成为普通的同步fifo。

module sirv_gnrl_bypbuf # (
parameter DP = 8,
parameter DW = 32
) (
input i_vld,
output i_rdy,
input [DW-1:0] i_dat, output o_vld,
input o_rdy,
output [DW-1:0] o_dat, input clk,
input rst_n
); wire fifo_i_vld;
wire fifo_i_rdy;
wire [DW-1:0] fifo_i_dat; wire fifo_o_vld;
wire fifo_o_rdy;
wire [DW-1:0] fifo_o_dat; sirv_gnrl_fifo # (
.DP(DP),
.DW(DW),
.CUT_READY(1)
) u_bypbuf_fifo(
.i_vld (fifo_i_vld),
.i_rdy (fifo_i_rdy),
.i_dat (fifo_i_dat),
.o_vld (fifo_o_vld),
.o_rdy (fifo_o_rdy),
.o_dat (fifo_o_dat),
.clk (clk ),
.rst_n (rst_n)
); // This module is a super-weapon for timing fix,
// but it is tricky, think it harder when you are reading, or contact Bob Hu assign i_rdy = fifo_i_rdy; // The FIFO is bypassed when:
// * fifo is empty, and o_rdy is high
wire byp = i_vld & o_rdy & (~fifo_o_vld); // FIFO o-ready just use the o_rdy
assign fifo_o_rdy = o_rdy; // The output is valid if FIFO or input have valid
assign o_vld = fifo_o_vld | i_vld; // The output data select the FIFO as high priority
assign o_dat = fifo_o_vld ? fifo_o_dat : i_dat; assign fifo_i_dat = i_dat; // Only pass to FIFO i-valid if FIFO is not bypassed
assign fifo_i_vld = i_vld & (~byp); endmodule
module sirv_gnrl_dffs_tb;

   reg  clk=0,rst_n;
reg i_vld, o_rdy;
reg [31:0] i_dat; wire i_rdy, o_vld;
wire [31:0] o_dat; sirv_gnrl_bypbuf #(.CUT_READY(1),.DP(4),.DW(32)) mybuf(.i_vld(i_vld),.i_rdy(i_rdy),.i_dat(i_dat),.o_vld(o_vld),.o_rdy(o_rdy),.o_dat(o_dat),.clk(clk),.rst_n(rst_n)); always #10 clk=~clk; initial
begin
rst_n=1'b1;
i_vld = 1'b0;
o_rdy = 1'b0;
i_dat = 32'h12345678;
#20
rst_n=1'b0;
#80
rst_n=1'b1;
#80
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h8;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h12;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h2;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h11;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h13;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h6;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h22;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h99;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h33;
#20
i_vld = 1'b0;
o_rdy = 1'b1;
i_dat = 32'h17;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h3;
#500 $finish;
end initial
$monitor($time,,,"clk=%b,rst_n=%b,i_vld=%b,o_rdy=%b, i_rdy=%b, o_vld=%b,",clk,rst_n,i_vld,o_rdy,i_rdy,o_vld);
initial
begin
//$dumpfile("dump.vcd");
//$dumpvars;
$fsdbDumpfile("dump.fsdb");
$fsdbDumpvars("+all");
end endmodule

用上面的testbench,可以看到是bypass buffer,fifo_o_vld总为0

module sirv_gnrl_dffs_tb;

   reg  clk=0,rst_n;
reg i_vld, o_rdy;
reg [31:0] i_dat; wire i_rdy, o_vld;
wire [31:0] o_dat; sirv_gnrl_bypbuf #(.CUT_READY(1),.DP(4),.DW(32)) mybuf(.i_vld(i_vld),.i_rdy(i_rdy),.i_dat(i_dat),.o_vld(o_vld),.o_rdy(o_rdy),.o_dat(o_dat),.clk(clk),.rst_n(rst_n)); always #10 clk=~clk; initial
begin
rst_n=1'b1;
i_vld = 1'b0;
o_rdy = 1'b0;
i_dat = 32'h12345678;
#20
rst_n=1'b0;
#80
rst_n=1'b1;
#80
i_vld = 1'b1;
o_rdy = 1'b0;
i_dat = 32'h8;
#20
i_vld = 1'b1;
o_rdy = 1'b0;
i_dat = 32'h12;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h2;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h11;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h13;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h6;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h22;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h99;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h33;
#20
i_vld = 1'b0;
o_rdy = 1'b1;
i_dat = 32'h17;
#20
i_vld = 1'b1;
o_rdy = 1'b1;
i_dat = 32'h3;
#500 $finish;
end initial
$monitor($time,,,"clk=%b,rst_n=%b,i_vld=%b,o_rdy=%b, i_rdy=%b, o_vld=%b,",clk,rst_n,i_vld,o_rdy,i_rdy,o_vld);
initial
begin
//$dumpfile("dump.vcd");
//$dumpvars;
$fsdbDumpfile("dump.fsdb");
$fsdbDumpvars("+all");
end endmodule

如果用上面的testbench,则变成普通的buffer,没有bypass

E203 bypass buffer的更多相关文章

  1. Method and system for early speculative store-load bypass

    In an embodiment, the present invention describes a method and apparatus for detecting RAW condition ...

  2. 优化ABAP性能(摘录)

    1.使用where语句不推荐Select * from zflight.Check : zflight-airln = ‘LF’ and zflight-fligh = ‘BW222’.Endsele ...

  3. abap 常用 function

    ABAP常用函数总结  alv .smartform. excel .text.邮件 .远程访问,FTP服务器...  **********常用功能function REUSE_ALV_GRID_DI ...

  4. Kingsoft Office Writer 2012 8.1.0.3385 - (.wps) Buffer Overflow Exploit (SEH)

    #!/usr/bin/python # Exploit Title: Kingsoft Office Writer v2012 8.1.0.3385 .wps Buffer Overflow Expl ...

  5. Buffer Data

    waylau/netty-4-user-guide: Chinese translation of Netty 4.x User Guide. 中文翻译<Netty 4.x 用户指南> h ...

  6. Tuning 04 Sizing the Buffer Cache

    Buffer Cache 特性 The buffer cache holds copies of the data blocks from the data files. Because the bu ...

  7. Speculative store buffer

    A speculative store buffer is speculatively updated in response to speculative store memory operatio ...

  8. 蜂鸟E203 IFU模块

    E203的IFU(instruction fetch unit)模块主要功能和接口如下: IFU的PC生成单元产生下一条指令的PC. 该PC传输到地址判断和ICB生成单元,就是根据PC值产生相应读指请 ...

  9. E203 同步fifo

    1. 输入端, 输入信号, i_vld,表示输入请求写同步fifo,如果fifo不满,则fifo发送i_rdy 到输入端,开始写fifo.i_vld和i_rdy是写握手信号. 2.输出端 o_rdy表 ...

随机推荐

  1. LayoutSubviews的调用

    1.当view被添加到另一个view上时调用 2.布局子控件时调用 3.屏幕旋转的时候调用 4.当view的尺寸大小改变的时候调用

  2. NetCoreAPI添加Swagger

    public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; ...

  3. Spring Cloud Netflix Ribbon详细介绍及自定义规则策略

    之前文章我们介绍了如何配置具有Ribbon轮询机制的负载均衡策略的消费者,这次来具体了解一下Ribbon的一些细节,以及如何自定义负载均衡策略等. 说一下Ribbon实现负载均衡的大致思路.它通过用@ ...

  4. 基于socketsever下实现的FTP

    # ### 客户端client import socket import json import struct import os sk = socket.socket() sk.connect( ( ...

  5. SRDC - ORA-1555: Query Duration 0: Checklist of Evidence to Supply (Doc ID 1682704.1)

    SRDC - ORA-1555: Query Duration 0: Checklist of Evidence to Supply (Doc ID 1682704.1) Action Plan 1. ...

  6. Nginx 配置高可用的集群

    1.什么是 nginx 高可用 (1)需要两台 nginx 服务器 (2)需要 keepalived (3)需要虚拟 ip 2.配置高可用的准备工作 (1)需要两台服务器 192.168.17.129 ...

  7. python详解json模块

    我们在做工作中经常会使用到json模块,今天就简单介绍下json模块 什么是json JSON ,全称为JavaScript Object Notation, 也就是JavaScript 对象标记,它 ...

  8. 05justify-content

    display: flex; 的默认轴是x轴 justify-content: 设置主轴上的子元素排列的方式 所以在使用之前要确定好哪一个是主轴 /* justify-content:flex-sta ...

  9. 父组件调用子组件中的方法- this.$refs.xxx.子组件方法();

    子组件中有一个说的方法 在父组件中去调用当你点击的时候 去调用子组件中的方法 fu.vue 在父组件的方法中调用子组件的方法,很重要 this.$refs.mychild.parentHandlecl ...

  10. 25.Java基础_继承

    继承的格式(Java类) Java中继承的注意事项 继承的好处与弊端 继承中成员变量的访问特点(对public形式的变量来说) 继承中成员函数的访问特点 this和super: 继承中构造方法的访问特 ...