43 input hclk,
// global clock to run axi_hp @ 150MHz, shared by all compressor channels 44 // Write dual port 8x27 channel start address/length RAM 45 input [
26:
0]
sa_len_di,
// data to write per-channle buffer sa/length in chunks 46 input [
2:
0]
sa_len_wa,
// channel address to write sa/lengths 49 input en,
// 0 - resets, 0->1 resets all pointers. While reset allows write response 51 input pre_busy_w,
// combinatorial signal - one before busy[0] (depends on ptr_resetting) 52 input [
1:
0]
pre_winner_channel,
// channel that won arbitration for AXI access, valid 1 cycle ahead of @ pre_busy_w 53 // input [ 1:0] winner_channel, // channel that won arbitration for AXI access, valid @ pre_busy_w 54 input need_to_bother,
// wants to start access if address and data FIFO permit 55 input [
1:
0]
chunk_inc_want_m1,
// how much to increment chunk pointer (0..3) +1 - valid with busy[0] (w/o rollover) 58 // last_burst_in_frame is invalid when rollover splits burst in 2 59 input [
3:
0]
busy,
// one cycle less than sending 1-4 bursts, [1] - delayed by 1, [2] - by 2 60 output ptr_resetting,
// pointers will be reset next cycle (2-cycle-long pulse) 61 output reg [
26:
0]
chunk_addr,
// chunk absolute address, valid with busy[1] 62 input [
2:
0]
chunk_ptr_ra,
// chunk pointer read address {eof, chn[1:0]} 63 output [
26:
0]
chunk_ptr_rd,
// chunk pointer read data (non-registered 64 // output [ 2:0] max_inc // maximal increment to rollover (limited by 4) 65 output [
2:
0]
max_wlen // maximal wlen[3:2], MSB - limited by rollover 68 reg [
3:
0]
reset_rq;
// request to reset pointers when ready 72 reg [
1:
0]
resetting;
// resetting chunk_pointer and eof_pointer 73 reg [
2:
0]
ptr_wa;
// pointer memory write port address, msb - eof/current, 2 LSB - channel 74 reg ptr_we;
// pointer memory write enable 75 reg [
26:
0]
ptr_ram[
0:
7];
// pointer (current and eof) memory (in 32-byte chunks 77 reg [
26:
0]
sa_len_ram[
0:
7];
// start chunk/num cunks in a buffer (write port @mclk) 79 // reg [27:0] rollover_r; // incremented chunk pointer, decremented by length (MSB - sign) 80 reg en_d;
//enable delayed by 1 cycle 81 wire [
2:
0]
sa_len_ra;
// start/len read address (0..3 - start addresses, 4..7 - lengths) 83 reg [
2:
0]
max_inc_ram[
0:
3];
// maximal increment to rollover (limited by 4) 89 // SuppressWarnings VEditor unused 94 wire rollover_w;
// this cycle causes rollover - valid at pre_busy_w 95 reg rollover_r;
// this cycle causes rollover - valid at busy[0] and late 96 reg [
1:
0]
winner_channel;
// channel that won arbitration for AXI access, valid @ pre_busy_w 100 // wire [2:0] max_wlen_di; // data to write to max_inc_ram and bypass register 103 // reg use_same_max_wlen; // valid @ pre_busy_w 116 /// assign max_wlen = max_inc_ram[winner_channel]; // valid @pre_busy_w 117 // assign max_wlen = (last_max_written == winner_channel) ? (max_inc_ram_we? max_wlen_di: max_wlen_same) :max_wlen_r ; // valid @pre_busy_w 126 // assign max_wlen_di = (|chunks_to_rollover_m1[3:2])?3'h7:{1'b0,chunks_to_rollover_m1[1:0]}; 127 // 1 cycle ahead of chunks_to_rollover_m1 136 // ===== calculate and rollover channel addresses ==== 137 // clear (during "resetting" or update 8x27 RAM that holds chunk pointers for the current burst and currenty frame 138 // uses (reads) additional memory with per-channel start addresses and lengths (both measured in 32-byte chunks 139 // read port of the ptr_ram will be used to monitor pointers through the status network 140 // TODO: Make sure correct RAM modules are inferred 160 ptr_we <=
resetting[
0] ||
// a pair of cycles to reset chunk pointer and frame chunk pointer 161 (
busy[
1] && !
busy[
2]) ||
// always update chunk pointer 164 if (
busy[
0] && !
busy[
1])
begin // first clock of busy 165 // calculate full address for current AXI burst (valid 1 clk after busy) 169 // if (busy[1] && !busy[2]) begin // first clock of busy 170 // chunk_ptr_rovr <={1'b0,chunk_ptr_inc} - {1'b0,sa_len_ram[sa_len_ra]}; // sa_len_ra now points at length 172 // write to ptr_ram (1 or 2 locations - if eof) 179 // wire [26:0] chunks_to_rollover; 181 // reg [3:0] chunks_to_rollover_r; // [3] >=8 187 // set 1 cycle earlier 192 // max_wlen_same <= max_wlen_di; [ 1:0] 262pre_winner_channel
300last_max_writtenreg[1:0]
[0:3] 285max_inc_ramreg[2:0]
289chunks_to_rollover_rreg[3:0]
[0:7] 279ptr_ramreg[26:0]
296winner_channelreg[1:0]
282chunk_ptr_increg[26:0]
288chunks_to_rolloverwire[26:0]
291pre_chunks_to_rollover_m1wire[3:0]
[0:7] 281sa_len_ramreg[26:0]
290chunks_to_rollover_m1wire[3:0]
[1:0] 264chunk_inc_want_m1
286pre_chunk_inc_m1wire[1:0]
293max_inc_ram_wareg[1:0]