From fd3e84941de463fa1a7ebab0a69515b4bf2614cd Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 7 Oct 2014 11:25:20 +0200 Subject: Removed copy of FPGA source files. --- fpga/usrp3/lib/control/Makefile.srcs | 28 --- fpga/usrp3/lib/control/README.txt | 0 fpga/usrp3/lib/control/arb_qualify_master.v | 88 --------- fpga/usrp3/lib/control/axi_crossbar.v | 167 ---------------- fpga/usrp3/lib/control/axi_crossbar_tb.v | 214 --------------------- fpga/usrp3/lib/control/axi_fifo_header.v | 84 -------- fpga/usrp3/lib/control/axi_forwarding_cam.v | 232 ----------------------- fpga/usrp3/lib/control/axi_slave_mux.v | 122 ------------ fpga/usrp3/lib/control/axi_test_vfifo.v | 139 -------------- fpga/usrp3/lib/control/binary_encoder.v | 42 ---- fpga/usrp3/lib/control/cvita_uart.v | 164 ---------------- fpga/usrp3/lib/control/dram_2port.v | 27 --- fpga/usrp3/lib/control/filter_bad_sid.v | 72 ------- fpga/usrp3/lib/control/gpio_atr.v | 66 ------- fpga/usrp3/lib/control/por_gen.v | 25 --- fpga/usrp3/lib/control/radio_ctrl_proc.v | 143 -------------- fpga/usrp3/lib/control/radio_ctrl_proc_tb.v | 104 ---------- fpga/usrp3/lib/control/ram_2port.v | 49 ----- fpga/usrp3/lib/control/reset_sync.v | 28 --- fpga/usrp3/lib/control/serial_to_settings.v | 121 ------------ fpga/usrp3/lib/control/serial_to_settings_tb.v | 82 -------- fpga/usrp3/lib/control/setting_reg.v | 35 ---- fpga/usrp3/lib/control/settings_bus_crossclock.v | 26 --- fpga/usrp3/lib/control/simple_i2c_core.v | 104 ---------- fpga/usrp3/lib/control/simple_spi_core.v | 215 --------------------- 25 files changed, 2377 deletions(-) delete mode 100644 fpga/usrp3/lib/control/Makefile.srcs delete mode 100644 fpga/usrp3/lib/control/README.txt delete mode 100644 fpga/usrp3/lib/control/arb_qualify_master.v delete mode 100644 fpga/usrp3/lib/control/axi_crossbar.v delete mode 100644 fpga/usrp3/lib/control/axi_crossbar_tb.v delete mode 100644 fpga/usrp3/lib/control/axi_fifo_header.v delete mode 100644 fpga/usrp3/lib/control/axi_forwarding_cam.v delete mode 100644 fpga/usrp3/lib/control/axi_slave_mux.v delete mode 100644 fpga/usrp3/lib/control/axi_test_vfifo.v delete mode 100644 fpga/usrp3/lib/control/binary_encoder.v delete mode 100644 fpga/usrp3/lib/control/cvita_uart.v delete mode 100644 fpga/usrp3/lib/control/dram_2port.v delete mode 100644 fpga/usrp3/lib/control/filter_bad_sid.v delete mode 100644 fpga/usrp3/lib/control/gpio_atr.v delete mode 100644 fpga/usrp3/lib/control/por_gen.v delete mode 100644 fpga/usrp3/lib/control/radio_ctrl_proc.v delete mode 100644 fpga/usrp3/lib/control/radio_ctrl_proc_tb.v delete mode 100644 fpga/usrp3/lib/control/ram_2port.v delete mode 100644 fpga/usrp3/lib/control/reset_sync.v delete mode 100644 fpga/usrp3/lib/control/serial_to_settings.v delete mode 100644 fpga/usrp3/lib/control/serial_to_settings_tb.v delete mode 100644 fpga/usrp3/lib/control/setting_reg.v delete mode 100644 fpga/usrp3/lib/control/settings_bus_crossclock.v delete mode 100644 fpga/usrp3/lib/control/simple_i2c_core.v delete mode 100644 fpga/usrp3/lib/control/simple_spi_core.v (limited to 'fpga/usrp3/lib/control') diff --git a/fpga/usrp3/lib/control/Makefile.srcs b/fpga/usrp3/lib/control/Makefile.srcs deleted file mode 100644 index 3576e0ee7..000000000 --- a/fpga/usrp3/lib/control/Makefile.srcs +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2013 Ettus Research LLC -# - -################################################## -# Control Lib Sources -################################################## -CONTROL_LIB_SRCS = $(abspath $(addprefix $(BASE_DIR)/../lib/control/, \ -reset_sync.v \ -por_gen.v \ -gpio_atr.v \ -simple_spi_core.v \ -simple_i2c_core.v \ -setting_reg.v \ -settings_bus_crossclock.v \ -radio_ctrl_proc.v \ -ram_2port.v \ -axi_crossbar.v \ -axi_slave_mux.v \ -axi_fifo_header.v \ -arb_qualify_master.v \ -axi_forwarding_cam.v \ -axi_test_vfifo.v \ -dram_2port.v \ -cvita_uart.v \ -serial_to_settings.v \ -filter_bad_sid.v \ -)) diff --git a/fpga/usrp3/lib/control/README.txt b/fpga/usrp3/lib/control/README.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/fpga/usrp3/lib/control/arb_qualify_master.v b/fpga/usrp3/lib/control/arb_qualify_master.v deleted file mode 100644 index df17fac57..000000000 --- a/fpga/usrp3/lib/control/arb_qualify_master.v +++ /dev/null @@ -1,88 +0,0 @@ -// -// Copyright 2012 Ettus Research LLC -// - - -// -// This module forms the qualification engine for a single master as -// part of a larger arbitration engine for a slave. It would typically -// be instantiated from arb_select_master.v to form a complete arbitor solution. -// - -module arb_qualify_master - #( - parameter WIDTH=16 // Bit width of destination field. - ) - ( - input clk, - input reset, - input clear, - // Header signals - input [WIDTH-1:0] header, - input header_valid, - // Slave Confg Signals - input [WIDTH-1:0] slave_addr, - input [WIDTH-1:0] slave_mask, - input slave_valid, - // Arbitration flags - output reg master_valid, - input master_ack - ); - - localparam WAIT_HEADER_VALID = 0; - localparam MATCH = 1; - localparam WAIT_HEADER_NOT_VALID = 2; - - - reg [1:0] state, next_state; - - - // Does masked slave address match header field for dest from master? - assign header_match = ((header & slave_mask) == (slave_addr & slave_mask)) && slave_valid; - - - always @(posedge clk) - if (reset | clear) begin - state <= WAIT_HEADER_VALID; - master_valid <= 0; - end else - begin - case(state) - // - // Wait here until Masters FIFO presents a valid header word. - // - WAIT_HEADER_VALID: begin - if (header_valid) - if (header_match) begin - state <= MATCH; - master_valid <= 1; - end else - next_state <= WAIT_HEADER_NOT_VALID; - end - // - // There should only ever be one match across various arbitors - // if they are configured correctly and since the backing FIFO in the - // master should not start to drain until the arbitration is won - // by that master, master_ack should always preceed de-assertion of - // header_valid so we don't check for the other order of deassertion. - // - MATCH: begin - if (master_ack) begin - master_valid <= 0; - state <= WAIT_HEADER_NOT_VALID; - end - end - // - // Wait here until this master starts to drain this packet from his FIFO. - // - WAIT_HEADER_NOT_VALID: begin - if (!header_valid) begin - state <= WAIT_HEADER_VALID; - end - end - endcase // case(state) - end // else: !if(reset | clear) - -endmodule // arb_qualify_master - - \ No newline at end of file diff --git a/fpga/usrp3/lib/control/axi_crossbar.v b/fpga/usrp3/lib/control/axi_crossbar.v deleted file mode 100644 index a408f69f0..000000000 --- a/fpga/usrp3/lib/control/axi_crossbar.v +++ /dev/null @@ -1,167 +0,0 @@ -// -// Copyright 2012 Ettus Research LLC -// - - -`define LOG2(N) (\ - N < 2 ? 0 : \ - N < 4 ? 1 : \ - N < 8 ? 2 : \ - N < 16 ? 3 : \ - N < 32 ? 4 : \ - N < 64 ? 5 : \ - N < 128 ? 6 : \ - N < 256 ? 7 : \ - N < 512 ? 8 : \ - N < 1024 ? 9 : \ - 10) - -module axi_crossbar - #( - parameter FIFO_WIDTH = 64, // AXI4-STREAM data bus width - parameter DST_WIDTH = 16, // Width of DST field we are routing on. - parameter NUM_INPUTS = 2, // number of input AXI4-STREAM buses - parameter NUM_OUTPUTS = 2 // number of output AXI4-STREAM buses - ) - ( - input clk, - input reset, - input clear, - input [7:0] local_addr, - // Inputs - input [(FIFO_WIDTH*NUM_INPUTS)-1:0] i_tdata, - input [NUM_INPUTS-1:0] i_tvalid, - input [NUM_INPUTS-1:0] i_tlast, - output [NUM_INPUTS-1:0] i_tready, - input [NUM_INPUTS-1:0] pkt_present, - // Setting Bus - input set_stb, - input [15:0] set_addr, - input [31:0] set_data, - // Output - output [(FIFO_WIDTH*NUM_OUTPUTS)-1:0] o_tdata, - output [NUM_OUTPUTS-1:0] o_tvalid, - output [NUM_OUTPUTS-1:0] o_tlast, - input [NUM_OUTPUTS-1:0] o_tready, - // readback bus - input rb_rd_stb, - input [`LOG2(NUM_OUTPUTS)+`LOG2(NUM_INPUTS)-1:0] rb_addr, - output [31:0] rb_data - ); - - genvar m,n; - - wire [(NUM_INPUTS*NUM_OUTPUTS)-1:0] forward_valid_in; - wire [(NUM_INPUTS*NUM_OUTPUTS)-1:0] forward_ack_in; - wire [(NUM_INPUTS*NUM_OUTPUTS)-1:0] forward_valid_out; - wire [(NUM_INPUTS*NUM_OUTPUTS)-1:0] forward_ack_out; - - wire [NUM_INPUTS-1:0] i_tready_slave [0:NUM_OUTPUTS-1]; - - // - // Instantiate an axi_slave_mux for every slave/output of the Crossbar switch. - // Each axi_slave_mux contains logic to maux and resolve arbitration - // for this particular slave/output. - // - - generate - for (m = 0; m < NUM_OUTPUTS; m = m + 1) begin: instantiate_slave_mux - - wire [NUM_INPUTS-1:0] i_tready_tmp; - - axi_slave_mux - #( - .FIFO_WIDTH(FIFO_WIDTH), // AXI4-STREAM data bus width - .DST_WIDTH(DST_WIDTH), // Width of DST field we are routing on. - .NUM_INPUTS(NUM_INPUTS) // number of input AXI buses - ) axi_slave_mux_i - ( - .clk(clk), - .reset(reset), - .clear(clear), - // Inputs - .i_tdata(i_tdata), - .i_tvalid(i_tvalid), - .i_tlast(i_tlast), - .i_tready(i_tready_tmp), - // Forwarding flags (One from each Input/Master) - .forward_valid(forward_valid_in[(m+1)*NUM_INPUTS-1:m*NUM_INPUTS]), - .forward_ack(forward_ack_out[(m+1)*NUM_INPUTS-1:m*NUM_INPUTS]), - // Output - .o_tdata(o_tdata[(m*FIFO_WIDTH)+FIFO_WIDTH-1:m*FIFO_WIDTH]), - .o_tvalid(o_tvalid[m]), - .o_tlast(o_tlast[m]), - .o_tready(o_tready[m]) - ); - - if (m==0) - assign i_tready_slave[0] = i_tready_tmp; - else - assign i_tready_slave[m] = i_tready_tmp | i_tready_slave[m-1] ; - - end // block: instantiate_slave_mux - endgenerate - - assign i_tready = i_tready_slave[NUM_OUTPUTS-1]; - - // - // Permute the forwarding flag buses - // - - generate - for (m = 0; m < NUM_OUTPUTS; m = m + 1) begin: permute_outer - for (n = 0; n < NUM_INPUTS; n = n + 1) begin: permute_inner - assign forward_valid_in[n*NUM_OUTPUTS+m] = forward_valid_out[n+m*NUM_INPUTS]; - assign forward_ack_in[n+m*NUM_INPUTS] = forward_ack_out[n*NUM_OUTPUTS+m]; - end - end - - endgenerate - - - // - // Instantiate an axi_forwarding_cam for every Input/Master of the Crossbar switch. - // Each contains a TCAM like lookup that allocates an egress port. - // - - wire [31:0] rb_data_mux[0:NUM_INPUTS-1]; - - generate - for (m = 0; m < NUM_INPUTS; m = m + 1) begin: instantiate_cam - axi_forwarding_cam - #( - .BASE(0), - .WIDTH(FIFO_WIDTH), // Bit width of FIFO word. - .NUM_OUTPUTS(NUM_OUTPUTS) - ) axi_forwarding_cam_i - ( - .clk(clk), - .reset(reset), - .clear(clear), - // Monitored FIFO signals - .o_tdata(i_tdata[(m*FIFO_WIDTH)+FIFO_WIDTH-1:m*FIFO_WIDTH]), - .o_tvalid(i_tvalid[m]), - .o_tready(i_tready[m]), - .o_tlast(i_tlast[m]), - .pkt_present(pkt_present[m]), - // Configuration - .local_addr(local_addr), - // Setting Bus - .set_stb(set_stb), - .set_addr(set_addr), - .set_data(set_data), - // Header signals - .forward_valid(forward_valid_out[(m+1)*NUM_OUTPUTS-1:m*NUM_OUTPUTS]), - .forward_ack(forward_ack_in[(m+1)*NUM_OUTPUTS-1:m*NUM_OUTPUTS]), - // Readback bus - .rb_rd_stb(rb_rd_strobe && (rb_addr[`LOG2(NUM_OUTPUTS)+`LOG2(NUM_INPUTS)-1:`LOG2(NUM_OUTPUTS)] == m)), - .rb_addr(rb_addr[`LOG2(NUM_OUTPUTS)-1:0]), - .rb_data(rb_data_mux[m]) - ); - end // block: instantiate_fifo_header - endgenerate - - assign rb_data = rb_data_mux[rb_addr[`LOG2(NUM_OUTPUTS)+`LOG2(NUM_INPUTS)-1:`LOG2(NUM_OUTPUTS)]]; - - -endmodule // axi_crossbar diff --git a/fpga/usrp3/lib/control/axi_crossbar_tb.v b/fpga/usrp3/lib/control/axi_crossbar_tb.v deleted file mode 100644 index 1994cb352..000000000 --- a/fpga/usrp3/lib/control/axi_crossbar_tb.v +++ /dev/null @@ -1,214 +0,0 @@ -// -// Copyright 2012 Ettus Research LLC -// - -`timescale 1 ps / 1 ps - -module axi_crossbar_tb; - - - localparam STREAM_WIDTH = 64; - - // Currently support simulations upto 8x8 configurations - localparam MAX_NUM_INPUTS = 8; - localparam MAX_NUM_OUTPUTS = 8; - - wire [(MAX_NUM_INPUTS*STREAM_WIDTH)-1:0] i_tdata; - wire [STREAM_WIDTH-1:0] i_tdata_array [0:MAX_NUM_INPUTS-1]; - wire [MAX_NUM_INPUTS-1:0] i_tvalid; - wire [MAX_NUM_INPUTS-1:0] i_tready; - wire [MAX_NUM_INPUTS-1:0] i_tlast; - wire [MAX_NUM_INPUTS-1:0] pkt_present; - - reg [STREAM_WIDTH-1:0] data_in [0:MAX_NUM_INPUTS-1]; - reg [MAX_NUM_INPUTS-1:0] valid_in; - wire [MAX_NUM_INPUTS-1:0] ready_in; - reg [MAX_NUM_INPUTS-1:0] last_in; - - wire [(MAX_NUM_OUTPUTS*STREAM_WIDTH)-1:0] o_tdata; - wire [STREAM_WIDTH-1:0] o_tdata_array [0:MAX_NUM_OUTPUTS-1]; - wire [MAX_NUM_OUTPUTS-1:0] o_tvalid; - wire [MAX_NUM_OUTPUTS-1:0] o_tready; - wire [MAX_NUM_OUTPUTS-1:0] o_tlast; - - - wire [STREAM_WIDTH-1:0] data_out [0:MAX_NUM_OUTPUTS-1]; - wire [MAX_NUM_OUTPUTS-1:0] valid_out; - reg [MAX_NUM_OUTPUTS-1:0] ready_out; - wire [MAX_NUM_OUTPUTS-1:0] last_out; - - - genvar m; - - reg clk; - reg reset; - reg clear; - reg set_stb; - reg [15:0] set_addr; - reg [31:0] set_data; - - // reg reset; - - // - // Simulation specific testbench is included here - // -`include "task_library.v" -`include "simulation_script.v" - - - // - // Define Clocks - // - initial begin - clk = 1'b1; - end - - // 125MHz clock - always #4000 clk = ~clk; - - // - // Good starting state - // - initial begin - reset <= 0; - clear <= 0; - set_stb <= 0; - set_addr <= 0; - set_data <= 0; -/* -----\/----- EXCLUDED -----\/----- - data_in[0] <= 0; - valid_in[0] <= 0; - last_in[0] <= 0; - - data_in[1] <= 0; - valid_in[1] <= 0; - last_in[1] <= 0; - -----/\----- EXCLUDED -----/\----- */ - - - end - - - - // - // AXI Crossbar instance - // - localparam SR_AWIDTH = 16; - localparam SR_XB_LOCAL = 512; - - wire [7:0] local_addr; - - setting_reg #(.my_addr(SR_XB_LOCAL), .awidth(SR_AWIDTH), .width(8)) sr_local_addr - (.clk(clk),.rst(reset),.strobe(set_stb),.addr(set_addr), - .in(set_data),.out(local_addr),.changed()); - - axi_crossbar - #( - .FIFO_WIDTH(STREAM_WIDTH), // AXI4-STREAM data bus width - .DST_WIDTH(16), // Width of DST field we are routing on. - .NUM_INPUTS(NUM_INPUTS), // number of input AXI4-STREAM buses - .NUM_OUTPUTS(NUM_OUTPUTS) // number of output AXI4-STREAM buses - ) axi_crossbar_i - ( - .clk(clk), - .reset(reset), - .clear(clear), - .local_addr(local_addr), - // Inputs - .i_tdata(i_tdata[(NUM_INPUTS*STREAM_WIDTH)-1:0]), - .i_tvalid(i_tvalid[NUM_INPUTS-1:0]), - .i_tlast(i_tlast[NUM_INPUTS-1:0]), - .i_tready(i_tready[NUM_INPUTS-1:0]), - .pkt_present(pkt_present[NUM_INPUTS-1:0]), - // Settings bus - .set_stb(set_stb), - .set_addr(set_addr), - .set_data(set_data), - // Output - .o_tdata(o_tdata[(NUM_OUTPUTS*STREAM_WIDTH)-1:0]), - .o_tvalid(o_tvalid[NUM_OUTPUTS-1:0]), - .o_tlast(o_tlast[NUM_OUTPUTS-1:0]), - .o_tready(o_tready[NUM_OUTPUTS-1:0]), - // Readback Bus - .rb_rd_stb(1'b0), - .rb_addr(0), - .rb_data() - ); - - // - // Input FIFOs - // - generate - for (m=0;m>9)) && set_stb; // Addr decode. - - always @(posedge clk) - begin - read_addr_reg <= read_addr; - - if (write) begin - mem[set_addr[8:0]] <= set_data[`LOG2(NUM_OUTPUTS)-1:0]; - end - - end - - assign read_data = mem[read_addr_reg]; - - - // - // State machine to manage forwarding flags. - // - always @(posedge clk) - if (reset | clear) begin - demux_state <= IDLE; - end else - case(demux_state) - - // Wait for Valid DST which indicates a new packet lookup in the CAM. - IDLE: begin - if (dst_valid_reg == 1) begin - forward_valid <= 1 << read_data; - demux_state <= FORWARD; - end - end - // When Slave/Output thats forwarding ACK's the forward flag, clear request and wait for packet to be transfered - FORWARD: begin - if ((forward_ack & forward_valid) != 0) begin - forward_valid <= 0; - demux_state <= WAIT; - end - end - // When packet transfered go back to idle. - WAIT: begin - if (forward_ack == 0) - demux_state <= IDLE; - end - - endcase // case (demux_state) - - // - // Compile forwarding statistics - // (This uses a lot of registers!) - // - genvar m; - reg [31:0] statistics [0:NUM_OUTPUTS-1]; - - generate - for (m = 0; m < NUM_OUTPUTS; m = m + 1) begin: generate_stats - always @(posedge clk) - if (reset | clear) - statistics[m] <= 0; - else if ((rb_addr == m) && rb_rd_stb) - statistics[m] <= 0; - else if (forward_ack[m] & forward_valid[m]) - statistics[m] <= statistics[m] + 1; - end - endgenerate - - assign rb_data = statistics[rb_addr]; - - -endmodule - - - - - diff --git a/fpga/usrp3/lib/control/axi_slave_mux.v b/fpga/usrp3/lib/control/axi_slave_mux.v deleted file mode 100644 index 1a307aba5..000000000 --- a/fpga/usrp3/lib/control/axi_slave_mux.v +++ /dev/null @@ -1,122 +0,0 @@ -// -// Copyright 2012 Ettus Research LLC -// - - - - -`define LOG2(N) (\ - N < 2 ? 0 : \ - N < 4 ? 1 : \ - N < 8 ? 2 : \ - N < 16 ? 3 : \ - N < 32 ? 4 : \ - N < 64 ? 5 : \ - N < 128 ? 6 : \ - N < 256 ? 7 : \ - N < 512 ? 8 : \ - N < 1024 ? 9 : \ - 10) - - -module axi_slave_mux - #( - parameter FIFO_WIDTH = 64, // AXI4-STREAM data bus width - parameter DST_WIDTH = 16, // Width of DST field we are routing on. - parameter NUM_INPUTS = 2 // number of input AXI buses - ) - ( - input clk, - input reset, - input clear, - // Inputs - input [(FIFO_WIDTH*NUM_INPUTS)-1:0] i_tdata, - input [NUM_INPUTS-1:0] i_tvalid, - input [NUM_INPUTS-1:0] i_tlast, - output [NUM_INPUTS-1:0] i_tready, - // Forwarding Flags - input [NUM_INPUTS-1:0] forward_valid, - output reg [NUM_INPUTS-1:0] forward_ack, - // Output - output [FIFO_WIDTH-1:0] o_tdata, - output o_tvalid, - output o_tlast, - input o_tready - ); - - wire [FIFO_WIDTH-1:0] i_tdata_array [0:NUM_INPUTS-1]; - - reg [`LOG2(NUM_INPUTS):0] select; - reg enable; - - - reg state; - - localparam CHECK_THIS_INPUT = 0; - localparam WAIT_LAST = 1; - - - always @(posedge clk) - if (reset | clear) begin - state <= CHECK_THIS_INPUT; - select <= 0; - enable <= 0; - forward_ack <= 0; - end else begin - case(state) - // Is the currently selected input addressing this slave with a ready packet? - CHECK_THIS_INPUT: begin - if (forward_valid[select]) begin - enable <= 1; - forward_ack[select] <= 1; - state <= WAIT_LAST; - end else if (select == NUM_INPUTS - 1 ) begin - select <= 0; - end else begin - select <= select + 1; - end - end - // Assert ACK immediately to forwarding logic and then wait for end of packet. - WAIT_LAST: begin - - if (i_tlast[select] && i_tvalid[select] && o_tready) begin - if (select == NUM_INPUTS - 1 ) begin - select <= 0; - end else begin - select <= select + 1; - end - state <= CHECK_THIS_INPUT; - forward_ack <= 0; - enable <= 0; - end else begin - forward_ack[select] <= 1; - enable <= 1; - end - end - endcase // case(state) - end - - // - // Combinatorial mux - // - genvar m; - - generate - for (m = 0; m < NUM_INPUTS; m = m + 1) begin: form_buses - assign i_tdata_array[m] = i_tdata[(m*FIFO_WIDTH)+FIFO_WIDTH-1:m*FIFO_WIDTH]; - end - endgenerate - - assign o_tdata = i_tdata_array[select]; - assign o_tvalid = enable && i_tvalid[select]; - assign o_tlast = enable && i_tlast[select]; - // assign i_tready = {NUM_INPUTS{o_tready}} & (enable << select); - - generate - for (m = 0; m < NUM_INPUTS; m = m + 1) begin: form_ready - assign i_tready[m] = o_tready && enable && (select == m); - end - endgenerate - - -endmodule // axi_slave_mux diff --git a/fpga/usrp3/lib/control/axi_test_vfifo.v b/fpga/usrp3/lib/control/axi_test_vfifo.v deleted file mode 100644 index a436e9c55..000000000 --- a/fpga/usrp3/lib/control/axi_test_vfifo.v +++ /dev/null @@ -1,139 +0,0 @@ -// -// 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 - - - - diff --git a/fpga/usrp3/lib/control/binary_encoder.v b/fpga/usrp3/lib/control/binary_encoder.v deleted file mode 100644 index e13a8174b..000000000 --- a/fpga/usrp3/lib/control/binary_encoder.v +++ /dev/null @@ -1,42 +0,0 @@ - -`define LOG2(N) (\ - N < 2 ? 0 : \ - N < 4 ? 1 : \ - N < 8 ? 2 : \ - N < 16 ? 3 : \ - N < 32 ? 4 : \ - N < 64 ? 5 : \ - N < 128 ? 6 : \ - N < 256 ? 7 : \ - N < 512 ? 8 : \ - N < 1024 ? 9 : \ - 10) - - module binary_encoder - #( - parameter SIZE = 16 - ) - ( - input [SIZE-1:0] in, - output [`LOG2(SIZE)-1:0] out - ); - - genvar m,n; - - generate - // Loop enough times to represent the total number of input bits as an encoded value - for (m = 0; m <= `log2(SIZE-1); m = m + 1) begin: expand_or_tree - wire [SIZE-1:0] encoding; - // Build enable mask by iterating through every input bit. - for (n = 0; n < SIZE ; n = n + 1) begin: encode_this_bit - assign encoding[n] = n[m]; - end - // OR tree for this output bit with appropraite bits enabled. - assign out[m] = |(encoding & in); - end - endgenerate -endmodule // binary_encoder - - - - \ No newline at end of file diff --git a/fpga/usrp3/lib/control/cvita_uart.v b/fpga/usrp3/lib/control/cvita_uart.v deleted file mode 100644 index cbb272fc2..000000000 --- a/fpga/usrp3/lib/control/cvita_uart.v +++ /dev/null @@ -1,164 +0,0 @@ - -// -// Copyright 2013 Ettus Research LLC -// - - -//create a compressed vita based uart data interface - -module cvita_uart -#( - parameter SIZE = 0 -) -( - //clocking interface - input clk, input rst, - - //uart interface - input rxd, output txd, - - //chdr fifo input - input [63:0] i_tdata, - input i_tlast, - input i_tvalid, - output i_tready, - - //chdr fifo output - output [63:0] o_tdata, - output o_tlast, - output o_tvalid, - input o_tready -); - - reg [31:0] sid; - - //baud clock divider - reg [15:0] clkdiv; - - //hold rx in disable until a tx event - reg rxd_enable; - - //================================================================== - //== RXD capture and packet generation interface - //================================================================== - wire [7:0] rx_char; - wire fifo_empty; - wire fifo_read; - reg [11:0] seqnum; - wire pgen_trigger; - wire pgen_done; - - //rx uart capture - simple_uart_rx #(.SIZE(SIZE)) simple_uart_rx - ( - .clk(clk), .rst(rst), - .fifo_out(rx_char), .fifo_read(fifo_read), .fifo_level(), .fifo_empty(fifo_empty), - .clkdiv(clkdiv), .rx(rxd) - ); - - //packet generation - holds rx character - context_packet_gen context_packet_gen - ( - .clk(clk), .reset(rst), .clear(1'b0), - .trigger(pgen_trigger), - .seqnum(seqnum), - .sid({sid[15:0], sid[31:16]}), - .body({56'b0, rx_char}), - .vita_time(64'b0), - - .done(pgen_done), - .o_tdata(o_tdata), .o_tlast(o_tlast), .o_tvalid(o_tvalid), .o_tready(o_tready) - ); - - //state machine to manage pgen and rx uart - reg [1:0] rxd_state; - localparam RXD_STATE_RECV_CHAR = 0; - localparam RXD_STATE_PGEN_TRIG = 1; - localparam RXD_STATE_WAIT_DONE = 2; - localparam RXD_STATE_READ_FIFO = 3; - - always @(posedge clk) begin - if (rst) begin - seqnum <= 12'b0; - rxd_state <= RXD_STATE_RECV_CHAR; - end - else case (rxd_state) - - RXD_STATE_RECV_CHAR: begin - if (!fifo_empty && rxd_enable) rxd_state <= RXD_STATE_PGEN_TRIG; - end - - RXD_STATE_PGEN_TRIG: begin - rxd_state <= RXD_STATE_WAIT_DONE; - end - - RXD_STATE_WAIT_DONE: begin - if (pgen_done) rxd_state <= RXD_STATE_READ_FIFO; - end - - RXD_STATE_READ_FIFO: begin - rxd_state <= RXD_STATE_RECV_CHAR; - seqnum <= seqnum + 1'b1; - end - - endcase //rxd_state - end - - assign fifo_read = (rxd_state == RXD_STATE_READ_FIFO) || (!rxd_enable); - assign pgen_trigger = (rxd_state == RXD_STATE_PGEN_TRIG); - - //================================================================== - //== TXD generation and packet control interface - //================================================================== - wire [7:0] tx_char; - wire fifo_write; - wire fifo_full; - - simple_uart_tx #(.SIZE(SIZE)) simple_uart_tx - ( - .clk(clk), .rst(rst), - .fifo_in(tx_char), .fifo_write(fifo_write), .fifo_level(), .fifo_full(fifo_full), - .clkdiv(clkdiv), .baudclk(), .tx(txd) - ); - - //state machine to manage control and tx uart - reg [1:0] txd_state; - localparam TXD_STATE_RECV_CHDR = 0; - localparam TXD_STATE_RECV_TIME = 1; - localparam TXD_STATE_RECV_BODY = 2; - localparam TXD_STATE_DROP_FIFO = 3; - - always @(posedge clk) begin - if (rst) begin; - txd_state <= TXD_STATE_RECV_CHDR; - rxd_enable <= 1'b0; - end - if (i_tvalid && i_tready) case (txd_state) - - TXD_STATE_RECV_CHDR: begin - txd_state <= (i_tdata[61])? TXD_STATE_RECV_TIME : TXD_STATE_RECV_BODY; - sid <= i_tdata[31:0]; - end - - TXD_STATE_RECV_TIME: begin - txd_state <= TXD_STATE_RECV_BODY; - end - - TXD_STATE_RECV_BODY: begin - txd_state <= (i_tlast)? TXD_STATE_RECV_CHDR : TXD_STATE_DROP_FIFO; - clkdiv <= i_tdata[47:32]; - rxd_enable <= 1'b1; - end - - TXD_STATE_DROP_FIFO: begin - if (i_tlast) txd_state <= TXD_STATE_RECV_CHDR; - end - - endcase //txd_state - end - - assign tx_char = i_tdata[7:0]; - assign fifo_write = (txd_state == TXD_STATE_RECV_BODY) && i_tvalid && i_tready; - assign i_tready = !fifo_full; - -endmodule // cvita_uart diff --git a/fpga/usrp3/lib/control/dram_2port.v b/fpga/usrp3/lib/control/dram_2port.v deleted file mode 100644 index 186af44e7..000000000 --- a/fpga/usrp3/lib/control/dram_2port.v +++ /dev/null @@ -1,27 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// Copyright Ettus Research LLC -//////////////////////////////////////////////////////////////////////// - -module dram_2port - #(parameter DWIDTH=32, - parameter AWIDTH=9) - (input clk, - input write, - input [AWIDTH-1:0] raddr, - input [AWIDTH-1:0] waddr, - input [DWIDTH-1:0] wdata, - output [DWIDTH-1:0] rdata); - - reg [DWIDTH-1:0] ram [(1<