如果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. iOS中session和cookie的使用

    获取session的方法: #pragma mark - 获取session -(NSString *)getsession{ NSHTTPCookieStorage *cookieStorage = ...

  2. Android开发利器之pidcat

    介绍pidcat: pidcat 是Android届JakeWharton大神开发的一款命令行工具,堪称Android开发利器,它能方便Android程序猿捕获日志,过滤日志,定位程序问题,超级好用. ...

  3. ucoreOS_lab4 实验报告

    所有的实验报告将会在 Github 同步更新,更多内容请移步至Github:https://github.com/AngelKitty/review_the_national_post-graduat ...

  4. [b0019] python 归纳 (五)_类装饰器

    总结: 类装饰器, 本质是一个函数,输入一个类,返回一个类 Case 1 啥都没做 def deco(in_class): return in_class @deco class Cat: def _ ...

  5. Angular 学习笔记(三)

    调试时抓取作用域: 1.右键选取审查元素,调出 debugger(或按 F12) 2.调试器允许用变量 $0 来获取当前选取的元素 3.在 console 中执行 angular.element($0 ...

  6. ACM-单向链表插入排序算法(在原链表上操作)

    /* 1.若链表只有一个节点或者为空,直接返回 2.将链表的前两个节点排序,并将排序之后的第二个节点的下一个节点赋空 3.此时整个链表分为了两个,将未排序的节点一一插入到已排序链表中:   3.1.第 ...

  7. httpd虚拟主机起不来!!

    前几天在公司,练习负载均衡配置.在配置虚拟主机的web服务(apache) ,创建好虚拟主机的配置文件 ss -tnl  查看监控端口80已起来,通过本地浏览器访问一直显示默认的欢迎页... 一个下午 ...

  8. 2.git的 分支管理

    一般我们进行提交的时候.都是在master上面提交的. git status 查看当前分支. [root@localhost jenkins_git]# git branch about * mast ...

  9. web-never give up

    打开题目连接 ?id=1 ,疑是注入点 但是输入其他数字无果 打开源码,发现注释有网页链接 打开连接123.206.87.240:8006/test/1p.html 发现回到了bugku的论坛首页,应 ...

  10. calcifications loss

    import keras import tensorflow as tf from keras.models import Model from keras import backend as K # ...