summaryrefslogtreecommitdiffstats
path: root/control_lib/shortfifo.v
diff options
context:
space:
mode:
authormatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>2008-12-04 06:12:51 +0000
committermatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>2008-12-04 06:12:51 +0000
commit9e47bbb499484ae92be6c3c9d96f4df0f73ddcd6 (patch)
treefdcdb3a8f135f4b141fe557e17695fd201f43c31 /control_lib/shortfifo.v
parentccd035728218077612b351ef4c4b3eaab4e68eab (diff)
downloaduhd-9e47bbb499484ae92be6c3c9d96f4df0f73ddcd6.tar.gz
uhd-9e47bbb499484ae92be6c3c9d96f4df0f73ddcd6.tar.bz2
uhd-9e47bbb499484ae92be6c3c9d96f4df0f73ddcd6.zip
speed up the diagnostic signals, they were causing timing problems
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10101 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'control_lib/shortfifo.v')
-rw-r--r--control_lib/shortfifo.v32
1 files changed, 28 insertions, 4 deletions
diff --git a/control_lib/shortfifo.v b/control_lib/shortfifo.v
index 83d2c1980..d8ce1428e 100644
--- a/control_lib/shortfifo.v
+++ b/control_lib/shortfifo.v
@@ -9,8 +9,8 @@ module shortfifo
input clear,
output reg full,
output reg empty,
- output [4:0] space,
- output [4:0] occupied);
+ output reg [4:0] space,
+ output reg [4:0] occupied);
reg [3:0] a;
genvar i;
@@ -57,7 +57,31 @@ module shortfifo
// NOTE will fail if you write into a full fifo or read from an empty one
- assign space = full ? 0 : empty ? 16 : 15-a;
- assign occupied = empty ? 0 : full ? 16 : a+1;
+ //////////////////////////////////////////////////////////////
+ // space and occupied are used for diagnostics, not
+ // guaranteed correct
+ //assign space = full ? 0 : empty ? 16 : 15-a;
+ //assign occupied = empty ? 0 : full ? 16 : a+1;
+
+ always @(posedge clk)
+ if(rst)
+ space <= 16;
+ else if(clear)
+ space <= 16;
+ else if(read & ~write)
+ space <= space + 1;
+ else if(write & ~read)
+ space <= space - 1;
+
+ always @(posedge clk)
+ if(rst)
+ occupied <= 0;
+ else if(clear)
+ occupied <= 0;
+ else if(read & ~write)
+ occupied <= occupied - 1;
+ else if(write & ~read)
+ occupied <= occupied + 1;
+
endmodule // shortfifo