summaryrefslogtreecommitdiffstats
path: root/usrp2/gpif/gpif_wr.v
diff options
context:
space:
mode:
authorMatt Ettus <matt@ettus.com>2010-06-14 16:14:30 -0700
committerMatt Ettus <matt@ettus.com>2011-05-26 17:31:19 -0700
commit014ea68739c616836bcdfce292c8ab89da26afad (patch)
tree18de12cf4488dd17718b9d59790f248be3342c3d /usrp2/gpif/gpif_wr.v
parente25f67d54ad40479415a5208b8f9a4739a79df30 (diff)
downloaduhd-014ea68739c616836bcdfce292c8ab89da26afad.tar.gz
uhd-014ea68739c616836bcdfce292c8ab89da26afad.tar.bz2
uhd-014ea68739c616836bcdfce292c8ab89da26afad.zip
gpif skeletons
Diffstat (limited to 'usrp2/gpif/gpif_wr.v')
-rw-r--r--usrp2/gpif/gpif_wr.v47
1 files changed, 47 insertions, 0 deletions
diff --git a/usrp2/gpif/gpif_wr.v b/usrp2/gpif/gpif_wr.v
new file mode 100644
index 000000000..c5cdc7597
--- /dev/null
+++ b/usrp2/gpif/gpif_wr.v
@@ -0,0 +1,47 @@
+
+module gpif_wr
+ (input gpif_clk, input gpif_rst,
+ input [15:0] gpif_data, input WR,
+ output reg have_space,
+
+ input sys_clk, input sys_rst,
+ output [19:0] data_o, output src_rdy_o, input dst_rdy_i,
+ output [31:0] debug );
+
+ reg wr_reg;
+ reg [15:0] gpif_data_reg;
+
+ always @(posedge gpif_clk)
+ begin
+ wr_reg <= WR;
+ gpif_data_reg <= gpif_data;
+ end
+
+ reg [9:0] write_count;
+
+ always @(posedge gpif_clk)
+ if(gpif_rst)
+ write_count <= 0;
+ else if(wr_reg)
+ write_count <= write_count + 1;
+ else
+ write_count <= 0;
+
+ reg sop;
+ wire occ = 0;
+ wire eop = (write_count == 255);
+
+ always @(posedge gpif_clk)
+ sop <= WR & ~wr_reg;
+
+ wire [15:0] fifo_space;
+ always @(posedge gpif_clk)
+ have_space <= fifo_space > 256;
+
+ fifo_2clock_cascade #(.WIDTH(19), .SIZE(9)) wr_fifo
+ (.wclk(gpif_clk), .datain({occ,eop,sop,gpif_data_reg}),
+ .src_rdy_i(wr_reg & ~write_count[8]), .dst_rdy_o(), .space(fifo_space),
+ .rclk(sys_clk), .dataout(data_o), .src_rdy_o(src_rdy_o), .dst_rdy_i(dst_rdy_i), .occupied(),
+ .arst(sys_rst));
+
+endmodule // gpif_wr