OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /qaz_libs/trunk/PCIe/src
    from Rev 35 to Rev 34
    Reverse comparison

Rev 35 → Rev 34

/RIFFA/riffa_chnl_rx.sv
31,14 → 31,13
N // data bus width in bytes
)
(
riffa_chnl_if chnl_bus,
input rx_ready,
riffa_chnl_if chnl_in,
output rx_done,
output reg [30:0] rx_index,
output reg rx_last,
output reg [31:0] rx_len,
output reg [30:0] rx_off,
// output rx_data_ren, // shouldn't be here??
output rx_data_ren,
output rd_empty,
output [(8*N)-1:0] rd_data,
input rd_en,
52,9 → 51,9
riffa_chnl_rx_fsm
riffa_chnl_rx_fsm_i
(
.rx(chnl_bus.rx),
.rx_data_valid(chnl_bus.rx_data_valid),
.rx_ack(chnl_bus.rx_ack),
.rx(chnl_in.rx),
.rx_data_valid(chnl_in.rx_data_valid),
.rx_ack(chnl_in.rx_ack),
.*
);
 
62,19 → 61,19
// --------------------------------------------------------------------
//
always_ff @(posedge clk)
if(chnl_bus.rx & chnl_bus.rx_ack)
if(chnl_in.rx & chnl_in.rx_ack)
begin
rx_last <= chnl_bus.rx_last;
rx_len <= chnl_bus.rx_len;
rx_off <= chnl_bus.rx_off;
rx_last <= chnl_in.rx_last;
rx_len <= chnl_in.rx_len;
rx_off <= chnl_in.rx_off;
end
 
 
// --------------------------------------------------------------------
//
wire [(8*N)-1:0] wr_data = chnl_bus.rx_data;
wire [(8*N)-1:0] wr_data = chnl_in.rx_data;
wire wr_full;
wire wr_en = chnl_bus.rx_data_ren & chnl_bus.rx_data_valid;
wire wr_en = chnl_in.rx_data_ren & chnl_in.rx_data_valid;
 
tiny_sync_fifo #(.W((8*N)))
tiny_sync_fifo_i(.*);
91,8 → 90,7
 
// --------------------------------------------------------------------
//
// assign rx_data_ren = ~wr_full; // shouldn't be here??
assign chnl_bus.rx_data_ren = ~wr_full;
assign rx_data_ren = ~wr_full;
 
 
// --------------------------------------------------------------------
/RIFFA/riffa_register_file.sv
28,8 → 28,9
module
riffa_register_file
#(
A, // address bus width
N, // data bus width in bytes
B // number of register banks
MW = 3 // mux select width
)
(
riffa_chnl_if chnl_in,
41,10 → 42,7
// --------------------------------------------------------------------
// synthesis translate_off
initial
begin
a_data_bus_mod: assert(N % 4 == 0) else $fatal;
a_data_bus_power_of_2: assert((N != 0) & ((N & (N - 1)) == 0)) else $fatal;
end
// synthesis translate_on
// --------------------------------------------------------------------
 
52,44 → 50,42
// --------------------------------------------------------------------
//
localparam RW = (N/4); // width of the bus in 32 bit words
localparam RC = RW * B; // number of available registers
localparam MI = 2 ** MW; // mux inputs
localparam LB = $clog2(RW);
localparam UB = LB + MW;
 
 
// --------------------------------------------------------------------
//
wire rx_ready = ~reset;
wire rx_done;
wire [30:0] rx_index;
wire [31:0] rx_index;
wire rx_last;
wire [31:0] rx_len;
wire [30:0] rx_off; // offset ignored, always start from offset 0
// wire rx_data_ren;
wire [30:0] rx_off;
wire rx_data_ren;
wire rd_empty;
wire [(8*N)-1:0] rd_data;
wire rd_en;
 
riffa_chn_rx #(.N(N))
riffa_chn_rx_i(.chnl_bus(chnl_in), .*);
riffa_chn_rx_i(.*);
 
 
// --------------------------------------------------------------------
//
wire register_select [RC-1:0];
genvar j, k;
wire register_select [MI-1:0];
genvar j;
 
generate
for(j = 0; j < B; j = j + 1)
begin: register_j_gen
for(k = 0; k < RW; k = k + 1)
begin: register_k_gen
assign register_select[(j*RW) + k] = (rx_index[30:$clog2(RW)] == j);
for(j = 0; j < MI; j = j + 1)
begin: decoder_gen
assign register_select[j] = (rx_index[UB:LB] == j) & (rx_index[31:UB] == 0) ? 1 : 0;
 
always_ff @(posedge clk)
if(reset)
r_if.register_out[(j*RW) + k] <= 0;
else if(rd_en & register_select[(j*RW) + k])
r_if.register_out[(j*RW) + k] <= rd_data[k*32 +: 32];
end
always_ff @(posedge clk)
if(reset)
r_if.register_out[j] <= 0;
else if(rd_en & register_select[j])
r_if.register_out[j] <= rd_data;
end
endgenerate
 
96,7 → 92,7
 
// --------------------------------------------------------------------
//
// assign chnl_in.rx_data_ren = rx_data_ren;
assign chnl_in.rx_data_ren = rx_data_ren;
assign rd_en = ~rd_empty;
 
 
104,10 → 100,9
//
wire tx_ready = 1;
wire tx_last = 1;
wire acked;
wire [31:0] tx_len = RC;
wire [31:0] tx_len = RW*MI;
wire [30:0] tx_off = 0;
wire [30:0] tx_index;
wire [31:0] tx_index;
wire tx_done = (tx_index >= chnl_in.tx_len - RW);
 
riffa_chn_tx #(.N(N))
116,27 → 111,12
 
// --------------------------------------------------------------------
//
wire [(N*8)-1:0] data_in [(2 ** $clog2(B))-1:0];
 
generate
for(j = 0; j < B; j = j + 1)
begin: data_in_j_gen
for(k = 0; k < RW; k = k + 1)
begin: data_in_k_gen
assign data_in[j][k*32 +: 32] = r_if.register_out[(j*RW) + k];
end
end
endgenerate
 
 
// --------------------------------------------------------------------
//
recursive_mux #(.A($clog2(B)), .W(N*8))
recursive_mux #(.A(MW), .W(N*8))
recursive_mux_i
(
.select(tx_index[$clog2(B) + $clog2(RW) - 1:$clog2(RW)]),
.data_out(chnl_in.tx_data),
.*
.select(tx_index[UB:LB]),
.data_in(r_if.register_in),
.data_out(chnl_in.tx_data)
);
 
 
147,9 → 127,9
assign chnl_in.rx_reset = reset;
assign chnl_in.tx_reset = reset;
assign chnl_in.tx_last = 1;
assign chnl_in.tx_len = RC;
assign chnl_in.tx_len = RW*MI;
assign chnl_in.tx_off = 0;
assign chnl_in.tx_data_valid = acked;
assign chnl_in.tx_data_valid = 1;
 
 
// --------------------------------------------------------------------
/RIFFA/riffa_chnl_rx_fsm.sv
30,7 → 30,6
(
input rx,
input rx_data_valid,
input rx_ready,
output rx_ack,
output rx_done,
 
68,11 → 67,7
else
next_state <= IDLE;
 
// ACK: next_state <= RX;
ACK: if(rx_ready)
next_state <= RX;
else
next_state <= ACK;
ACK: next_state <= RX;
 
RX: if(rx)
next_state <= RX;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.