parameterMCNTRL_SCANLINE_PENDING_CNTR_BITS=2,// Number of bits to count pending trasfers, currently 2 is enough, but may increase
parameterMCNTRL_SCANLINE_PENDING_CNTR_BITS=2,// Number of bits to count pending trasfers, currently 2 is enough, but may increase
// if memory controller will allow programming several sequences in advance to
// if memory controller will allow programming several sequences in advance to
// spread long-programming (tiled) over fast-programming (linear) requests.
// spread long-programming (tiled) over fast-programming (linear) requests.
// But that should not be too big to maintain 2-level priorities
// But that should not be too big to maintain 2-level priorities
parameterMCNTRL_SCANLINE_FRAME_PAGE_RESET=1'b0,// reset internal page number to zero at the frame start (false - only when hard/soft reset)
parameterMAX_TILE_WIDTH=6,// number of bits to specify maximal tile (width-1) (6 -> 64)
parameterMAX_TILE_WIDTH=6,// number of bits to specify maximal tile (width-1) (6 -> 64)
parameterMAX_TILE_HEIGHT=6,// number of bits to specify maximal tile (height-1) (6 -> 64)
parameterMAX_TILE_HEIGHT=6,// number of bits to specify maximal tile (height-1) (6 -> 64)
parameterMCNTRL_TILED_CHN4_ADDR='h140,
parameterMCNTRL_TILED_CHN2_ADDR='h140,
parameterMCNTRL_TILED_CHN5_ADDR='h150,
parameterMCNTRL_TILED_CHN4_ADDR='h150,
parameterMCNTRL_TILED_MASK='h3f0,// both channels 0 and 1
parameterMCNTRL_TILED_MASK='h3f0,// both channels 0 and 1
parameterMCNTRL_TILED_MODE='h0,// set mode register: {extra_pages[1:0],write_mode,enable,!reset}
parameterMCNTRL_TILED_MODE='h0,// set mode register: {extra_pages[1:0],write_mode,enable,!reset}
parameterMCNTRL_TILED_STATUS_CNTRL='h1,// control status reporting
parameterMCNTRL_TILED_STATUS_CNTRL='h1,// control status reporting
...
@@ -202,7 +212,8 @@ module mcntrl393 #(
...
@@ -202,7 +212,8 @@ module mcntrl393 #(
// TODO: Add number of blocks to R/W? (blocks can be different) - total length?
// TODO: Add number of blocks to R/W? (blocks can be different) - total length?
// Read back current address (for debugging)?
// Read back current address (for debugging)?
parameterMCNTRL_TILED_TILE_WHS='h7,// low word - 6-bit tile width in 8-bursts, high - tile height (0 - > 64)
parameterMCNTRL_TILED_TILE_WHS='h7,// low word - 6-bit tile width in 8-bursts, high - tile height (0 - > 64)
parameterMCNTRL_TILED_STATUS_REG_CHN4_ADDR='h5,
parameterMCNTRL_TILED_STATUS_REG_CHN2_ADDR='h5,
parameterMCNTRL_TILED_STATUS_REG_CHN4_ADDR='h7,
parameterMCNTRL_TILED_PENDING_CNTR_BITS=2,// Number of bits to count pending trasfers, currently 2 is enough, but may increase
parameterMCNTRL_TILED_PENDING_CNTR_BITS=2,// Number of bits to count pending trasfers, currently 2 is enough, but may increase
// if memory controller will allow programming several sequences in advance to
// if memory controller will allow programming several sequences in advance to
// spread long-programming (tiled) over fast-programming (linear) requests.
// spread long-programming (tiled) over fast-programming (linear) requests.
...
@@ -259,6 +270,14 @@ module mcntrl393 #(
...
@@ -259,6 +270,14 @@ module mcntrl393 #(
// Channels 2 and 3 control signals
// Channels 2 and 3 control signals
// TODO: move line_unfinished and suspend to internals of this module (and control comparator modes)
// TODO: move line_unfinished and suspend to internals of this module (and control comparator modes)
inputframe_start_chn1,// resets page, x,y, and initiates transfer requests (in write mode will wait for next_page)
inputnext_page_chn1,// page was read/written from/to 4*1kB on-chip buffer
outputpage_ready_chn1,// == xfer_done, connect externally | Single-cycle pulse indicating that a page was read/written from/to DDR3 memory
outputframe_done_chn1,// single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// optional I/O for channel synchronization
output[FRAME_HEIGHT_BITS-1:0]line_unfinished_chn1,// number of the current (ufinished ) line, REALATIVE TO FRAME, NOT WINDOW?.
inputsuspend_chn1,// suspend transfers (from external line number comparator)
inputframe_start_chn2,// resets page, x,y, and initiates transfer requests (in write mode will wait for next_page)
inputframe_start_chn2,// resets page, x,y, and initiates transfer requests (in write mode will wait for next_page)
inputnext_page_chn2,// page was read/written from/to 4*1kB on-chip buffer
inputnext_page_chn2,// page was read/written from/to 4*1kB on-chip buffer
outputpage_ready_chn2,// == xfer_done, connect externally | Single-cycle pulse indicating that a page was read/written from/to DDR3 memory
outputpage_ready_chn2,// == xfer_done, connect externally | Single-cycle pulse indicating that a page was read/written from/to DDR3 memory
...
@@ -282,14 +301,6 @@ module mcntrl393 #(
...
@@ -282,14 +301,6 @@ module mcntrl393 #(
// optional I/O for channel synchronization
// optional I/O for channel synchronization
output[FRAME_HEIGHT_BITS-1:0]line_unfinished_chn4,// number of the current (ufinished ) line, REALATIVE TO FRAME, NOT WINDOW?.
output[FRAME_HEIGHT_BITS-1:0]line_unfinished_chn4,// number of the current (ufinished ) line, REALATIVE TO FRAME, NOT WINDOW?.
inputsuspend_chn4,// suspend transfers (from external line number comparator)
inputsuspend_chn4,// suspend transfers (from external line number comparator)
// Channel 5 (tiled write)
inputframe_start_chn5,// resets page, x,y, and initiates transfer requests (in write mode will wait for next_page)
inputnext_page_chn5,// page was read/written from/to 4*1kB on-chip buffer
outputpage_ready_chn5,// == xfer_done, connect externally | Single-cycle pulse indicating that a page was read/written from/to DDR3 memory
outputframe_done_chn5,// single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// optional I/O for channel synchronization
output[FRAME_HEIGHT_BITS-1:0]line_unfinished_chn5,// number of the current (ufinished ) line, REALATIVE TO FRAME, NOT WINDOW?.
inputsuspend_chn5,// suspend transfers (from external line number comparator)
// DDR3 interface
// DDR3 interface
...
@@ -340,83 +351,79 @@ module mcntrl393 #(
...
@@ -340,83 +351,79 @@ module mcntrl393 #(
// wire seq_wr0; // not used
// wire seq_wr0; // not used
wireseq_set0;
wireseq_set0;
wireseq_done0;
wireseq_done0;
// wire rpage_nxt_chn0;
wirebuf_wr_chn0;
wirebuf_wr_chn0;
wirebuf_wpage_nxt_chn0;
wirebuf_wpage_nxt_chn0;
wirebuf_run0;
wirebuf_run0;
wire[63:0]buf_wdata_chn0;
wire[63:0]buf_wdata_chn0;
wirebuf_wrun0;
wirebuf_rd_chn0;
wirebuf_rpage_nxt_chn0;
wire[63:0]buf_rdata_chn0;
wirewant_rq1;
wirewant_rq1;
wireneed_rq1;
wireneed_rq1;
wirechannel_pgm_en1;
wirechannel_pgm_en1;
wireseq_done1;
wireseq_done1;
wirerpage_nxt_chn1;
wirepage_nxt_chn1;
wirebuf_run1;
wirebuf_wr_chn1;
wirebuf_wpage_nxt_chn1;
wire[63:0]buf_wdata_chn1;
wirebuf_rd_chn1;
wirebuf_rd_chn1;
wirerpage_nxt_chn1;
wire[63:0]buf_rdata_chn1;
wire[63:0]buf_rdata_chn1;
wirewant_rq2;
wirewant_rq2;
wireneed_rq2;
wireneed_rq2;
wirechannel_pgm_en2;
wirechannel_pgm_en2;
wire[31:0]seq_data2x;// may be shared with other channel
wireseq_wr2x;// may be shared with other channel
wireseq_set2x;// may be shared with other channel
wireseq_done2;
wireseq_done2;
// wire rpage_nxt_chn2;
wirepage_nxt_chn2;
wirebuf_wr_chn2;
wirebuf_wr_chn2;
wirebuf_wpage_nxt_chn2;
wirebuf_wpage_nxt_chn2;
wire[63:0]buf_wdata_chn2;
wire[63:0]buf_wdata_chn2;
wirebuf_rd_chn2;
wirerpage_nxt_chn2;
wire[63:0]buf_rdata_chn2;
wirewant_rq3;
wirewant_rq3;
wireneed_rq3;
wireneed_rq3;
wirechannel_pgm_en3;
wirechannel_pgm_en3;
wire[31:0]seq_data3x;// may be shared with other channel
wireseq_wr3x;// may be shared with other channel
wireseq_set3x;// may be shared with other channel
wireseq_done3;
wireseq_done3;
wirerpage_nxt_chn3;
wirepage_nxt_chn3;
wirebuf_wr_chn3;
wirebuf_wpage_nxt_chn3;
wire[63:0]buf_wdata_chn3;
wirebuf_rd_chn3;
wirebuf_rd_chn3;
wirerpage_nxt_chn3;
wire[63:0]buf_rdata_chn3;
wire[63:0]buf_rdata_chn3;
wirewant_rq4;
wirewant_rq4;
wireneed_rq4;
wireneed_rq4;
wirechannel_pgm_en4;
wirechannel_pgm_en4;
// wire seq_tiled_start_rd;
wire[31:0]seq_data4x;// may be shared with other channel
wireseq_wr4x;// may be shared with other channel
wireseq_set4x;// may be shared with other channel
wireseq_done4;
wireseq_done4;
wirerpage_nxt_chn4;
wirepage_nxt_chn4;
wirebuf_wr_chn4;
wirebuf_wr_chn4;
wirebuf_wpage_nxt_chn4;
wirebuf_wpage_nxt_chn4;
wire[63:0]buf_wdata_chn4;
wire[63:0]buf_wdata_chn4;
wirebuf_rd_chn4;
wirerpage_nxt_chn4;
wire[63:0]buf_rdata_chn4;
wirewant_rq5;
wireneed_rq5;
wirechannel_pgm_en5;
wire[31:0]seq_data5x;// may be shared with other channel
wireseq_wr5x;// may be shared with other channel
wireseq_set5x;// may be shared with other channel
wireseq_done5;
wirerpage_nxt_chn5;
wirebuf_rd_chn5;
wire[63:0]buf_rdata_chn5;
// Command tree - insert register layer if needed
// Command tree - insert register layer if needed
wire[7:0]cmd_mcontr_ad;
wire[7:0]cmd_mcontr_ad;
wirecmd_mcontr_stb;
wirecmd_mcontr_stb;
wire[7:0]cmd_ps_pio_ad;
wire[7:0]cmd_ps_pio_ad;
wirecmd_ps_pio_stb;
wirecmd_ps_pio_stb;
wire[7:0]cmd_scanline_chn2_ad;
wire[7:0]cmd_scanline_chn1_ad;
wirecmd_scanline_chn2_stb;
wirecmd_scanline_chn1_stb;
wire[7:0]cmd_scanline_chn3_ad;
wire[7:0]cmd_scanline_chn3_ad;
wirecmd_scanline_chn3_stb;
wirecmd_scanline_chn3_stb;
wire[7:0]cmd_tiled_chn2_ad;
wirecmd_tiled_chn2_stb;
wire[7:0]cmd_tiled_chn4_ad;
wire[7:0]cmd_tiled_chn4_ad;
wirecmd_tiled_chn4_stb;
wirecmd_tiled_chn4_stb;
wire[7:0]cmd_tiled_chn5_ad;
wirecmd_tiled_chn5_stb;
// Status tree:
// Status tree:
...
@@ -428,42 +435,52 @@ module mcntrl393 #(
...
@@ -428,42 +435,52 @@ module mcntrl393 #(
wirestatus_ps_pio_rq;// PS PIO channels status request
wirestatus_ps_pio_rq;// PS PIO channels status request
wirestatus_ps_pio_start;// PS PIO channels status packet transfer start (currently with 0 latency from status_root_rq)
wirestatus_ps_pio_start;// PS PIO channels status packet transfer start (currently with 0 latency from status_root_rq)
wire[7:0]status_scanline_chn2_ad;// PL scanline channel2 (memory read) status byte-wide address/data
wire[7:0]status_scanline_chn1_ad;// PL scanline channel1 (memory read) status byte-wide address/data
wirestatus_scanline_chn2_rq;// PL scanline channel2 (memory read) channels status request
wirestatus_scanline_chn1_rq;// PL scanline channel1 (memory read) channels status request
wirestatus_scanline_chn2_start;// PL scanline channel2 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wirestatus_scanline_chn1_start;// PL scanline channel1 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wire[7:0]status_scanline_chn3_ad;// PL scanline channel3 (memory read) status byte-wide address/data
wire[7:0]status_scanline_chn3_ad;// PL scanline channel3 (memory read) status byte-wide address/data
wirestatus_scanline_chn3_rq;// PL scanline channel3 (memory read) channels status request
wirestatus_scanline_chn3_rq;// PL scanline channel3 (memory read) channels status request
wirestatus_scanline_chn3_start;// PL scanline channel3 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wirestatus_scanline_chn3_start;// PL scanline channel3 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wire[7:0]status_tiled_chn2_ad;// PL tiled channel2 (memory read) status byte-wide address/data
wirestatus_tiled_chn2_rq;// PL tiled channel2 (memory read) channels status request
wirestatus_tiled_chn2_start;// PL tiled channel2 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wire[7:0]status_tiled_chn4_ad;// PL tiled channel4 (memory read) status byte-wide address/data
wire[7:0]status_tiled_chn4_ad;// PL tiled channel4 (memory read) status byte-wide address/data
wirestatus_tiled_chn4_rq;// PL tiled channel4 (memory read) channels status request
wirestatus_tiled_chn4_rq;// PL tiled channel4 (memory read) channels status request
wirestatus_tiled_chn4_start;// PL tiled channel4 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wirestatus_tiled_chn4_start;// PL tiled channel4 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
wire[7:0]status_tiled_chn5_ad;// PL tiled channel5 (memory read) status byte-wide address/data
wirestatus_tiled_chn5_rq;// PL tiled channel5 (memory read) channels status request
wirestatus_tiled_chn5_start;// PL tiled channel5 (memory read) channels status packet transfer start (currently with 0 latency from status_root_rq)
// combinatorial early signals
// combinatorial early signals
wireselect_cmd0_w;
wireselect_cmd0_w;
wireselect_buf0_w;
wireselect_buf0rd_w;
wireselect_buf1_w;
wireselect_buf0wr_w;
wireselect_buf2_w;
wireselect_buf1rd_w;
wireselect_buf3_w;
wireselect_buf1wr_w;
wireselect_buf4_w;
wireselect_buf2rd_w;
wireselect_buf5_w;
wireselect_buf2wr_w;
wireselect_buf3rd_w;
wireselect_buf3wr_w;
wireselect_buf4rd_w;
wireselect_buf4wr_w;
// registered selects
// registered selects
regselect_cmd0;
regselect_cmd0;
regselect_buf0;
regselect_buf0rd;
regselect_buf1;
regselect_buf0wr;
regselect_buf2;
regselect_buf1rd;
regselect_buf3;
regselect_buf1wr;
regselect_buf4;
regselect_buf2rd;
regselect_buf5;
regselect_buf2wr;
regselect_buf3rd;
regselect_buf0_d;// delayed by 1 clock, for combining with regen?
regselect_buf3wr;
regselect_buf2_d;
regselect_buf4rd;
regselect_buf4_d;
regselect_buf4wr;
regselect_buf0rd_d;// delayed by 1 clock, for combining with regen?
regselect_buf1rd_d;
regselect_buf2rd_d;
regselect_buf3rd_d;
regselect_buf4rd_d;
regaxird_selected_r;// this module provides output
regaxird_selected_r;// this module provides output
...
@@ -471,51 +488,62 @@ module mcntrl393 #(
...
@@ -471,51 +488,62 @@ module mcntrl393 #(
reg[BUFFER_DEPTH32-1:0]buf_waddr;
reg[BUFFER_DEPTH32-1:0]buf_waddr;
reg[31:0]buf_wdata;
reg[31:0]buf_wdata;
regcmd_we;
regcmd_we;
regbuf1_we;
regbuf0wr_we;
regbuf3_we;
regbuf1wr_we;
regbuf5_we;
regbuf2wr_we;
regbuf3wr_we;
regbuf4wr_we;
wire[BUFFER_DEPTH32-1:0]buf_raddr;
wire[BUFFER_DEPTH32-1:0]buf_raddr;
wire[31:0]buf0_data;
wire[31:0]buf0_data;
wire[31:0]buf2_data;
wire[31:0]buf1rd_data;
wire[31:0]buf4_data;
wire[31:0]buf2rd_data;
wire[31:0]buf3rd_data;
wire[31:0]buf4rd_data;
wirebuf0_rd;
wirebuf0_rd;
wirebuf0_regen;
wirebuf0_regen;
wirebuf2_rd;
wirebuf1rd_rd;
wirebuf2_regen;
wirebuf1rd_regen;
wirebuf4_rd;
wirebuf2rd_rd;
wirebuf4_regen;
wirebuf2rd_regen;
wirebuf3rd_rd;
// common for channels 2 and 3
wirebuf3rd_regen;
wirebuf4rd_rd;
wirebuf4rd_regen;
// common for channels 1 and 3
wire[2:0]lin_rw_bank;// memory bank
wire[2:0]lin_rw_bank;// memory bank
wire[ADDRESS_NUMBER-1:0]lin_rw_row;// memory row
wire[ADDRESS_NUMBER-1:0]lin_rw_row;// memory row
wire[COLADDR_NUMBER-4:0]lin_rw_col;// start memory column in 8-bursts
wire[COLADDR_NUMBER-4:0]lin_rw_col;// start memory column in 8-bursts
wire[5:0]lin_rw_num128;// number of 128-bit words to transfer (8*16 bits) - full bursts of 8 ( 0 - maximal length, 64)
wire[5:0]lin_rw_num128;// number of 128-bit words to transfer (8*16 bits) - full bursts of 8 ( 0 - maximal length, 64)
wirelin_rw_xfer_partial;// do not increment page in the end, continue current
wirelin_rw_xfer_partial;// do not increment page in the end, continue current
wirelin_rd_start;// start generating commands for read sequence
wirelin_rw_start_rd;// start generating commands for read sequence
wirelin_wr_start;// start generating commands for write sequence
wirelin_rw_start_wr;// start generating commands for write sequence
// VDT bugs: 1:does not propagate undefined width through ?:, 2: - does not allow to connect it to task integer input, 3: shows integer input width as 1
// VDT bugs: 1:does not propagate undefined width through ?:, 2: - does not allow to connect it to task integer input, 3: shows integer input width as 1