aboutsummaryrefslogtreecommitdiffstats
path: root/fpga/usrp3/lib/control/axi_test_vfifo.v
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-01-23 16:10:22 -0800
committerMartin Braun <martin.braun@ettus.com>2020-01-28 09:35:36 -0800
commitbafa9d95453387814ef25e6b6256ba8db2df612f (patch)
tree39ba24b5b67072d354775272e687796bb511848d /fpga/usrp3/lib/control/axi_test_vfifo.v
parent3075b981503002df3115d5f1d0b97d2619ba30f2 (diff)
downloaduhd-bafa9d95453387814ef25e6b6256ba8db2df612f.tar.gz
uhd-bafa9d95453387814ef25e6b6256ba8db2df612f.tar.bz2
uhd-bafa9d95453387814ef25e6b6256ba8db2df612f.zip
Merge FPGA repository back into UHD repository
The FPGA codebase was removed from the UHD repository in 2014 to reduce the size of the repository. However, over the last half-decade, the split between the repositories has proven more burdensome than it has been helpful. By merging the FPGA code back, it will be possible to create atomic commits that touch both FPGA and UHD codebases. Continuous integration testing is also simplified by merging the repositories, because it was previously difficult to automatically derive the correct UHD branch when testing a feature branch on the FPGA repository. This commit also updates the license files and paths therein. We are therefore merging the repositories again. Future development for FPGA code will happen in the same repository as the UHD host code and MPM code. == Original Codebase and Rebasing == The original FPGA repository will be hosted for the foreseeable future at its original local location: https://github.com/EttusResearch/fpga/ It can be used for bisecting, reference, and a more detailed history. The final commit from said repository to be merged here is 05003794e2da61cabf64dd278c45685a7abad7ec. This commit is tagged as v4.0.0.0-pre-uhd-merge. If you have changes in the FPGA repository that you want to rebase onto the UHD repository, simply run the following commands: - Create a directory to store patches (this should be an empty directory): mkdir ~/patches - Now make sure that your FPGA codebase is based on the same state as the code that was merged: cd src/fpga # Or wherever your FPGA code is stored git rebase v4.0.0.0-pre-uhd-merge Note: The rebase command may look slightly different depending on what exactly you're trying to rebase. - Create a patch set for your changes versus v4.0.0.0-pre-uhd-merge: git format-patch v4.0.0.0-pre-uhd-merge -o ~/patches Note: Make sure that only patches are stored in your output directory. It should otherwise be empty. Make sure that you picked the correct range of commits, and only commits you wanted to rebase were exported as patch files. - Go to the UHD repository and apply the patches: cd src/uhd # Or wherever your UHD repository is stored git am --directory fpga ~/patches/* rm -rf ~/patches # This is for cleanup == Contributors == The following people have contributed mainly to these files (this list is not complete): Co-authored-by: Alex Williams <alex.williams@ni.com> Co-authored-by: Andrej Rode <andrej.rode@ettus.com> Co-authored-by: Ashish Chaudhari <ashish@ettus.com> Co-authored-by: Ben Hilburn <ben.hilburn@ettus.com> Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com> Co-authored-by: Daniel Jepson <daniel.jepson@ni.com> Co-authored-by: Derek Kozel <derek.kozel@ettus.com> Co-authored-by: EJ Kreinar <ej@he360.com> Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com> Co-authored-by: Ian Buckley <ian.buckley@gmail.com> Co-authored-by: Jörg Hofrichter <joerg.hofrichter@ni.com> Co-authored-by: Jon Kiser <jon.kiser@ni.com> Co-authored-by: Josh Blum <josh@joshknows.com> Co-authored-by: Jonathon Pendlum <jonathan.pendlum@ettus.com> Co-authored-by: Martin Braun <martin.braun@ettus.com> Co-authored-by: Matt Ettus <matt@ettus.com> Co-authored-by: Michael West <michael.west@ettus.com> Co-authored-by: Moritz Fischer <moritz.fischer@ettus.com> Co-authored-by: Nick Foster <nick@ettus.com> Co-authored-by: Nicolas Cuervo <nicolas.cuervo@ettus.com> Co-authored-by: Paul Butler <paul.butler@ni.com> Co-authored-by: Paul David <paul.david@ettus.com> Co-authored-by: Ryan Marlow <ryan.marlow@ettus.com> Co-authored-by: Sugandha Gupta <sugandha.gupta@ettus.com> Co-authored-by: Sylvain Munaut <tnt@246tNt.com> Co-authored-by: Trung Tran <trung.tran@ettus.com> Co-authored-by: Vidush Vishwanath <vidush.vishwanath@ettus.com> Co-authored-by: Wade Fife <wade.fife@ettus.com>
Diffstat (limited to 'fpga/usrp3/lib/control/axi_test_vfifo.v')
-rw-r--r--fpga/usrp3/lib/control/axi_test_vfifo.v145
1 files changed, 145 insertions, 0 deletions
diff --git a/fpga/usrp3/lib/control/axi_test_vfifo.v b/fpga/usrp3/lib/control/axi_test_vfifo.v
new file mode 100644
index 000000000..1d37bfd1b
--- /dev/null
+++ b/fpga/usrp3/lib/control/axi_test_vfifo.v
@@ -0,0 +1,145 @@
+//
+// Copyright 2014 Ettus Research LLC
+// Copyright 2018 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: LGPL-3.0-or-later
+//
+//
+// Test Virtual FIFO's by streaming modulo 2^32 counter (replicated in upper
+// and lower 32bits). Test result by tracking count on receive and using
+// sticky flag for error indication.
+// Also provide signal from MSB of 32bit count to blink LED.
+//
+
+module axi_test_vfifo
+ #(parameter PACKET_SIZE = 128)
+ (
+ input aclk,
+ input aresetn,
+ input enable,
+ // AXI Stream Out
+ output reg out_axis_tvalid,
+ input out_axis_tready,
+ output [63 : 0] out_axis_tdata,
+ output reg [7 : 0] out_axis_tstrb,
+ output reg [7 : 0] out_axis_tkeep,
+ output reg out_axis_tlast,
+ output reg [0 : 0] out_axis_tid,
+ output reg [0 : 0] out_axis_tdest,
+ input vfifo_full,
+ // AXI Stream In
+ input in_axis_tvalid,
+ output reg in_axis_tready,
+ input [63 : 0] in_axis_tdata,
+ input [7 : 0] in_axis_tstrb,
+ input [7 : 0] in_axis_tkeep,
+ input in_axis_tlast,
+ input [0 : 0] in_axis_tid,
+ input [0 : 0] in_axis_tdest,
+ // Flags
+ output reg flag_error,
+ output heartbeat_in,
+ output heartbeat_out,
+ output [31:0] expected_count
+ );
+
+
+ reg [31:0] out_count;
+ reg [31:0] in_count;
+ reg [63:0] in_axis_tdata_reg;
+ reg in_data_valid;
+
+
+
+ //
+ // Output
+ //
+ always @(posedge aclk)
+ if (!aresetn) begin
+ out_count <= 0;
+ out_axis_tvalid <= 0;
+ out_axis_tid <= 0; // Don't care.
+ out_axis_tdest <= 0; // Only use port 0 of VFIFO.
+ out_axis_tstrb <= 0; // Unused in VFIFO
+ out_axis_tkeep <= 8'hFF; // Always use every byte of data
+ out_axis_tlast <= 1'b0;
+ end else if (enable) begin
+ if (~vfifo_full) begin
+ // Always ready to output new count value.
+ out_axis_tvalid <= 1;
+ if (out_axis_tready)
+ out_count <= out_count + 1;
+ // Assert TLAST every PACKET_SIZE beats.
+ if (out_count[15:0] == PACKET_SIZE)
+ out_axis_tlast <= 1'b1;
+ else
+ out_axis_tlast <= 1'b0;
+ end else begin
+ out_axis_tvalid <= 0;
+ end
+ end else begin
+ out_axis_tlast <= 1'b0;
+ out_axis_tvalid <= 0;
+ end
+
+ assign out_axis_tdata = {out_count,out_count};
+
+ assign heartbeat_out = out_count[28];
+
+
+ //
+ // Input (Ignore TLAST signal)
+ //
+ always @(posedge aclk)
+ if (!aresetn) begin
+ in_axis_tready <= 0;
+ in_axis_tdata_reg <= 0;
+ in_data_valid <= 0;
+
+ end else if (enable) begin
+ in_axis_tready <= 1;
+ in_axis_tdata_reg <= in_axis_tdata;
+ if (in_axis_tvalid)
+ in_data_valid <= 1;
+ else
+ in_data_valid <= 0;
+ end else begin
+ in_data_valid <= 0;
+ in_axis_tready <= 0;
+ end // else: !if(enable)
+
+
+ assign heartbeat_in = in_count[28];
+
+ //
+ // Input Checker
+ //
+ always @(posedge aclk)
+ if (!aresetn) begin
+ in_count <= 0;
+ flag_error <= 0;
+ end else if (enable) begin
+ if (in_data_valid) begin
+
+ if ((in_axis_tdata_reg[63:32] != in_count) || (in_axis_tdata_reg[31:0] != in_count))
+ begin
+ flag_error <= 1;
+ in_count <= in_axis_tdata_reg[63:32] + 1;
+ end
+ else
+ begin
+ flag_error <= 0;
+ in_count <= in_count + 1;
+ end
+
+ end
+ end
+
+ assign expected_count = in_count;
+
+
+endmodule // axi_test_vfifo
+
+
+
+