Commit 8b79e3f7 authored by Andrey Filippov's avatar Andrey Filippov

simulating/debugging

parent 890bad1c
...@@ -62,77 +62,77 @@ ...@@ -62,77 +62,77 @@
<link> <link>
<name>vivado_logs/VivadoBitstream.log</name> <name>vivado_logs/VivadoBitstream.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoBitstream-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoBitstream-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOpt.log</name> <name>vivado_logs/VivadoOpt.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOpt-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOpt-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOptPhys.log</name> <name>vivado_logs/VivadoOptPhys.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOptPhys-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOptPhys-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOptPower.log</name> <name>vivado_logs/VivadoOptPower.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOptPower-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOptPower-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoPlace.log</name> <name>vivado_logs/VivadoPlace.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoPlace-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoPlace-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoRoute.log</name> <name>vivado_logs/VivadoRoute.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoRoute-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoRoute-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoSynthesis.log</name> <name>vivado_logs/VivadoSynthesis.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoSynthesis-20150426202222327.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoSynthesis-20150428234540494.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimimgSummaryReportImplemented.log</name> <name>vivado_logs/VivadoTimimgSummaryReportImplemented.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportImplemented-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportImplemented-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimimgSummaryReportSynthesis.log</name> <name>vivado_logs/VivadoTimimgSummaryReportSynthesis.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportSynthesis-20150426202222327.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportSynthesis-20150428234540494.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimingReportImplemented.log</name> <name>vivado_logs/VivadoTimingReportImplemented.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoTimingReportImplemented-20150426202414513.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoTimingReportImplemented-20150428234740722.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimingReportSynthesis.log</name> <name>vivado_logs/VivadoTimingReportSynthesis.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoTimingReportSynthesis-20150426202222327.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoTimingReportSynthesis-20150428234540494.log</location>
</link> </link>
<link> <link>
<name>vivado_state/x393-opt-phys.dcp</name> <name>vivado_state/x393-opt-phys.dcp</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_state/x393-opt-phys-20150426202414513.dcp</location> <location>/home/andrey/git/x393/vivado_state/x393-opt-phys-20150428234740722.dcp</location>
</link> </link>
<link> <link>
<name>vivado_state/x393-place.dcp</name> <name>vivado_state/x393-place.dcp</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_state/x393-place-20150426202414513.dcp</location> <location>/home/andrey/git/x393/vivado_state/x393-place-20150428234740722.dcp</location>
</link> </link>
<link> <link>
<name>vivado_state/x393-route.dcp</name> <name>vivado_state/x393-route.dcp</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_state/x393-route-20150426202414513.dcp</location> <location>/home/andrey/git/x393/vivado_state/x393-route-20150428234740722.dcp</location>
</link> </link>
<link> <link>
<name>vivado_state/x393-synth.dcp</name> <name>vivado_state/x393-synth.dcp</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_state/x393-synth-20150426202222327.dcp</location> <location>/home/andrey/git/x393/vivado_state/x393-synth-20150428234540494.dcp</location>
</link> </link>
</linkedResources> </linkedResources>
</projectDescription> </projectDescription>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
module membridge#( module membridge#(
parameter MEMBRIDGE_ADDR= 'h200, parameter MEMBRIDGE_ADDR= 'h200,
parameter MEMBRIDGE_MASK= 'h3f0, parameter MEMBRIDGE_MASK= 'h3f0,
parameter MEMBRIDGE_CTRL= 'h0, // bit 0 - enable, bits[2:1]: 01 - start, 11 - start and reset address parameter MEMBRIDGE_CTRL= 'h0, // bit 0 - enable, bits[2:1]: 11 - start(continue), 01 - start and reset address
parameter MEMBRIDGE_STATUS_CNTRL= 'h1, parameter MEMBRIDGE_STATUS_CNTRL= 'h1,
parameter MEMBRIDGE_LO_ADDR64= 'h2, // low address of the system memory, in 64-bit words (<<3 to get byte address) parameter MEMBRIDGE_LO_ADDR64= 'h2, // low address of the system memory, in 64-bit words (<<3 to get byte address)
parameter MEMBRIDGE_SIZE64= 'h3, // size of the system memory range (access will roll over to lo_addr parameter MEMBRIDGE_SIZE64= 'h3, // size of the system memory range (access will roll over to lo_addr
...@@ -52,7 +52,7 @@ module membridge#( ...@@ -52,7 +52,7 @@ module membridge#(
input page_ready_chn, // output single mclk input page_ready_chn, // output single mclk
input frame_done_chn, // output single mclk input frame_done_chn, // output single mclk
input [FRAME_HEIGHT_BITS-1:0] line_unfinished_chn1, // output[15:0] @SuppressThisWarning VEditor unused (yet) input [FRAME_HEIGHT_BITS-1:0] line_unfinished_chn1, // output[15:0] @SuppressThisWarning VEditor unused (yet)
output suspend_chn1, // input @SuppressThisWarning VEditor unused (yet) output suspend_chn1, //
// buffer interface, DDR3 memory read // buffer interface, DDR3 memory read
input xfer_reset_page_rd, // input input xfer_reset_page_rd, // input
input buf_wpage_nxt, // input input buf_wpage_nxt, // input
...@@ -138,8 +138,8 @@ module membridge#( ...@@ -138,8 +138,8 @@ module membridge#(
assign afi_rdissuecap1en = 1'b0; assign afi_rdissuecap1en = 1'b0;
assign frame_start_chn=start_mclk; assign frame_start_chn = start_mclk;
assign suspend_chn1 = 1'b0;
wire [ 3:0] cmd_a; // control register address wire [ 3:0] cmd_a; // control register address
wire [31:0] cmd_data; // register data wire [31:0] cmd_data; // register data
wire cmd_we; // register write wire cmd_we; // register write
...@@ -277,7 +277,7 @@ module membridge#( ...@@ -277,7 +277,7 @@ module membridge#(
pulse_cross_clock next_page_i (.rst(rst), .src_clk(hclk), .dst_clk(mclk), .in_pulse(next_page), .out_pulse(next_page_chn),.busy(busy_next_page)); pulse_cross_clock next_page_i (.rst(rst), .src_clk(hclk), .dst_clk(mclk), .in_pulse(next_page), .out_pulse(next_page_chn),.busy(busy_next_page));
// Common to both directions // Common to both directions
localparam DELAY_ADVANCE_ADDR=4; localparam DELAY_ADVANCE_ADDR=3;
reg [28:0] rel_addr64; // realtive (to lo_addr) address reg [28:0] rel_addr64; // realtive (to lo_addr) address
wire advance_rel_addr_w; wire advance_rel_addr_w;
wire advance_rel_addr_wr; wire advance_rel_addr_wr;
...@@ -308,8 +308,8 @@ module membridge#( ...@@ -308,8 +308,8 @@ module membridge#(
assign left_zero = low4_zero && last_burst; assign left_zero = low4_zero && last_burst;
always @ (posedge hclk or posedge rst) begin always @ (posedge hclk or posedge rst) begin
if (rst) advance_rel_addr_d <= 0; if (rst) advance_rel_addr_d <= 0;
else if (advance_rel_addr_w) advance_rel_addr_d <= {DELAY_ADVANCE_ADDR{1'b1}}; // else if (advance_rel_addr_w) advance_rel_addr_d <= {DELAY_ADVANCE_ADDR{1'b1}};
else advance_rel_addr_d <= advance_rel_addr_d << 1; else advance_rel_addr_d <= {advance_rel_addr_d[DELAY_ADVANCE_ADDR-2:0],advance_rel_addr};
end end
...@@ -322,17 +322,17 @@ module membridge#( ...@@ -322,17 +322,17 @@ module membridge#(
assign rw_in_progress = read_started || write_busy; assign rw_in_progress = read_started || write_busy;
always @ (posedge hclk) begin always @ (posedge hclk) begin
advance_rel_addr <= advance_rel_addr_w && !advance_rel_addr_d[DELAY_ADVANCE_ADDR-1]; // make sure advance_rel_addr_w is recalculated after address change advance_rel_addr <= advance_rel_addr_w && !advance_rel_addr && !(|advance_rel_addr_d); // make sure advance_rel_addr_w is recalculated after address change
last_burst <= ! (|left64[28:4]); last_burst <= ! (|left64[28:4]);
rollover <= rel_addr64[28:4] == last_addr1k; rollover <= rel_addr64[28:4] == last_addr1k;
low4_zero <= ! (|left64[3:0]); low4_zero <= ! (|left64[3:0]);
if (rdwr_start[0] && rdwr_reset_addr) rel_addr64 <= start64; if (rdwr_start[0] && rdwr_reset_addr) rel_addr64 <= start64;
else if (advance_rel_addr) rel_addr64 <= last_burst?(rel_addr64 + left64[3:0]) : (rollover?29'h0:(rel_addr64 + 4'h10)); else if (advance_rel_addr) rel_addr64 <= last_burst?(rel_addr64 + {25'h0,left64[3:0]}) : (rollover?29'h0:(rel_addr64 + 29'h10));
axi_addr64 <= lo_addr64 + rel_addr64; axi_addr64 <= lo_addr64 + rel_addr64;
if (rdwr_start) left64 <= len64; if (rdwr_start) left64 <= len64;
else if (advance_rel_addr) left64 <= last_burst? 0: (left64 - 4'h10); else if (advance_rel_addr) left64 <= last_burst? 0: (left64 - 29'h10);
afi_len <= (|left64[28:4])?4'hf : (left64[3:0]-1); afi_len <= (|left64[28:4])?4'hf : (left64[3:0]-1);
afi_len_plus1 <= (|left64[28:4]) ? 5'h10 : {1'b0,left64[3:0]}; afi_len_plus1 <= (|left64[28:4]) ? 5'h10 : {1'b0,left64[3:0]};
...@@ -381,11 +381,15 @@ module membridge#( ...@@ -381,11 +381,15 @@ module membridge#(
else if (!read_busy) read_started <= 0; else if (!read_busy) read_started <= 0;
else if (page_ready) read_started <= 1; // first page is in the buffer - use it to mask page number comparison else if (page_ready) read_started <= 1; // first page is in the buffer - use it to mask page number comparison
//TODO: Make wresp_pending as difference of 2 counters, wa - on input (variable increment) wresp - on output
if (rst) wresp_pending <= 0; if (rst) wresp_pending <= 0;
else if (!read_busy) wresp_pending <= 0; else if (!read_busy) wresp_pending <= 0;
else if ( afi_wvalid && !afi_bvalid_r) wresp_pending <= wresp_pending +1; else if ( afi_wvalid && !afi_bvalid_r) wresp_pending <= wresp_pending +1;
else if (!afi_wvalid && afi_bvalid_r) wresp_pending <= wresp_pending -1; else if (!afi_wvalid && afi_bvalid_r) wresp_pending <= wresp_pending -1;
read_over <= left_zero && (wresp_pending == 0); // TODO: Make a counter for addresses outside of afi_wacount
read_over <= left_zero && (wresp_pending == 0) && (afi_wacount==0);
if (rst) read_page <= 0; if (rst) read_page <= 0;
else if (reset_page_rd) read_page <= 0; else if (reset_page_rd) read_page <= 0;
...@@ -408,6 +412,7 @@ module membridge#( ...@@ -408,6 +412,7 @@ module membridge#(
if (rst) done <= 0; if (rst) done <= 0;
else if (!rdwr_en) done <= 0; // disabling when idle will reset done else if (!rdwr_en) done <= 0; // disabling when idle will reset done
else if ((write_busy && frame_done) || (read_busy && read_over)) done <= 1; else if ((write_busy && frame_done) || (read_busy && read_over)) done <= 1;
else if (rdwr_start) done <= 0;
end end
...@@ -434,9 +439,9 @@ module membridge#( ...@@ -434,9 +439,9 @@ module membridge#(
//last_in_line64 - last word number in scan line //last_in_line64 - last word number in scan line
reg left_was_1; // was 1 or 0 (0 does not matter) reg left_was_1; // was 1 or 0 (0 does not matter)
reg [3:0] src_wcntr; reg [3:0] src_wcntr;
reg [1:0] wlast_in_burst; reg [2:0] wlast_in_burst;
assign afi_wlast = wlast_in_burst[1]; assign afi_wlast = wlast_in_burst[2];
always @ (posedge hclk) begin always @ (posedge hclk) begin
if (!rw_in_progress) left_was_1 <= 0; if (!rw_in_progress) left_was_1 <= 0;
...@@ -446,7 +451,7 @@ module membridge#( ...@@ -446,7 +451,7 @@ module membridge#(
else if (bufrd_rd[0]) src_wcntr <= src_wcntr+1; else if (bufrd_rd[0]) src_wcntr <= src_wcntr+1;
if (!read_started) wlast_in_burst <= 0; if (!read_started) wlast_in_burst <= 0;
else if (bufrd_rd[0]) wlast_in_burst <= {wlast_in_burst[0],left_was_1 | (&src_wcntr)}; else if (bufrd_rd[0]) wlast_in_burst <= {wlast_in_burst[1:0],left_was_1 | (&src_wcntr)};
bufrd_rd <= {bufrd_rd[1:0], bufrd_rd_w }; bufrd_rd <= {bufrd_rd[1:0], bufrd_rd_w };
buf_rdwr <= bufrd_rd_w || bufwr_we_w; buf_rdwr <= bufrd_rd_w || bufwr_we_w;
...@@ -515,7 +520,7 @@ module membridge#( ...@@ -515,7 +520,7 @@ module membridge#(
else if (next_page_wr_w) write_page <= write_page + 1; else if (next_page_wr_w) write_page <= write_page + 1;
if (rst) write_pages_ready <= 0; if (rst) write_pages_ready <= 0;
else if (!read_busy) write_pages_ready <= 0; else if (!write_busy) write_pages_ready <= 0;
else if ( page_ready_wr && !next_page_wr_w) write_pages_ready <= write_pages_ready -1; //+1; else if ( page_ready_wr && !next_page_wr_w) write_pages_ready <= write_pages_ready -1; //+1;
else if (!page_ready_wr && next_page_wr_w) write_pages_ready <= write_pages_ready +1; //-1; else if (!page_ready_wr && next_page_wr_w) write_pages_ready <= write_pages_ready +1; //-1;
...@@ -552,7 +557,7 @@ module membridge#( ...@@ -552,7 +557,7 @@ module membridge#(
.clk (mclk), // input .clk (mclk), // input
.we (set_status_w), // input .we (set_status_w), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status ({busy,done}), // input[25:0] .status ({done,busy}), // input[25:0]
.ad (status_ad), // output[7:0] .ad (status_ad), // output[7:0]
.rq (status_rq), // output .rq (status_rq), // output
.start (status_start) // input .start (status_start) // input
......
...@@ -118,6 +118,11 @@ ...@@ -118,6 +118,11 @@
localparam STATUS_PSHIFTER_RDY_MASK = 1<<STATUS_2LSB_SHFT; localparam STATUS_PSHIFTER_RDY_MASK = 1<<STATUS_2LSB_SHFT;
localparam FRAME_START_ADDRESS= 'h1000; // RA=80, CA=0, BA=0 22-bit frame start address (3 CA LSBs==0. BA==0) localparam FRAME_START_ADDRESS= 'h1000; // RA=80, CA=0, BA=0 22-bit frame start address (3 CA LSBs==0. BA==0)
localparam FRAME_FULL_WIDTH= 'h0c0; // Padded line length (8-row increment), in 8-bursts (16 bytes) localparam FRAME_FULL_WIDTH= 'h0c0; // Padded line length (8-row increment), in 8-bursts (16 bytes)
localparam AFI_LO_ADDR64= 'h4000; // start of the system memory range in 64-bit words
localparam AFI_SIZE64= 'h4000; // size of system memory range in 64-bit words
// localparam SCANLINE_WINDOW_WH= `h079000a2; // 2592*1936: low word - 13-bit window width (0->'h4000), high word - 16-bit frame height (0->'h10000) // localparam SCANLINE_WINDOW_WH= `h079000a2; // 2592*1936: low word - 13-bit window width (0->'h4000), high word - 16-bit frame height (0->'h10000)
// localparam SCANLINE_WINDOW_WH= 'h0009000b; // 176*9: low word - 13-bit window width (0->'h4000), high word - 16-bit frame height (0->'h10000) // localparam SCANLINE_WINDOW_WH= 'h0009000b; // 176*9: low word - 13-bit window width (0->'h4000), high word - 16-bit frame height (0->'h10000)
localparam WINDOW_WIDTH= 'h000b; //'h005b; //'h000b; // 176: 13-bit window width (0->'h4000) localparam WINDOW_WIDTH= 'h000b; //'h005b; //'h000b; // 176: 13-bit window width (0->'h4000)
......
...@@ -85,12 +85,12 @@ task write_block_buf_chn; // S uppressThisWarning VEditor : may be unused ...@@ -85,12 +85,12 @@ task write_block_buf_chn; // S uppressThisWarning VEditor : may be unused
begin begin
case (chn) case (chn)
0: start_addr=MCONTR_BUF0_WR_ADDR + (page << 8); 0: start_addr=MCONTR_BUF0_WR_ADDR + (page << 8);
1: start_addr=MCONTR_BUF1_WR_ADDR + (page << 8); // 1: start_addr=MCONTR_BUF1_WR_ADDR + (page << 8);
2: start_addr=MCONTR_BUF2_WR_ADDR + (page << 8); 2: start_addr=MCONTR_BUF2_WR_ADDR + (page << 8);
3: start_addr=MCONTR_BUF3_WR_ADDR + (page << 8); 3: start_addr=MCONTR_BUF3_WR_ADDR + (page << 8);
4: start_addr=MCONTR_BUF4_WR_ADDR + (page << 8); 4: start_addr=MCONTR_BUF4_WR_ADDR + (page << 8);
default: begin default: begin
$display("**** ERROR: Invalid channel for write buffer = %d @%t", chn, $time); $display("**** ERROR: Invalid channel (not 0,2,3,4) for write buffer = %d @%t", chn, $time);
start_addr = MCONTR_BUF0_WR_ADDR+ (page << 8); start_addr = MCONTR_BUF0_WR_ADDR+ (page << 8);
end end
endcase endcase
...@@ -142,12 +142,12 @@ task read_block_buf_chn; // S uppressThisWarning VEditor : may be unused ...@@ -142,12 +142,12 @@ task read_block_buf_chn; // S uppressThisWarning VEditor : may be unused
begin begin
case (chn) case (chn)
0: start_addr=MCONTR_BUF0_RD_ADDR + (page << 8); 0: start_addr=MCONTR_BUF0_RD_ADDR + (page << 8);
1: start_addr=MCONTR_BUF1_RD_ADDR + (page << 8); // 1: start_addr=MCONTR_BUF1_RD_ADDR + (page << 8);
2: start_addr=MCONTR_BUF2_RD_ADDR + (page << 8); 2: start_addr=MCONTR_BUF2_RD_ADDR + (page << 8);
3: start_addr=MCONTR_BUF3_RD_ADDR + (page << 8); 3: start_addr=MCONTR_BUF3_RD_ADDR + (page << 8);
4: start_addr=MCONTR_BUF4_RD_ADDR + (page << 8); 4: start_addr=MCONTR_BUF4_RD_ADDR + (page << 8);
default: begin default: begin
$display("**** ERROR: Invalid channel for read buffer = %d @%t", chn, $time); $display("**** ERROR: Invalid channel (not 0,2,3,4) for read buffer = %d @%t", chn, $time);
start_addr = 30'b0+ (page << 8); start_addr = 30'b0+ (page << 8);
end end
endcase endcase
......
...@@ -85,10 +85,12 @@ endtask ...@@ -85,10 +85,12 @@ endtask
read_status (MCNTRL_SCANLINE_STATUS_REG_CHN3_ADDR); read_status (MCNTRL_SCANLINE_STATUS_REG_CHN3_ADDR);
read_status (MCNTRL_TILED_STATUS_REG_CHN2_ADDR); read_status (MCNTRL_TILED_STATUS_REG_CHN2_ADDR);
read_status (MCNTRL_TILED_STATUS_REG_CHN4_ADDR); read_status (MCNTRL_TILED_STATUS_REG_CHN4_ADDR);
read_status (MCNTRL_TEST01_STATUS_REG_CHN1_ADDR); // read_status (MCNTRL_TEST01_STATUS_REG_CHN1_ADDR);
read_status (MCNTRL_TEST01_STATUS_REG_CHN2_ADDR); read_status (MCNTRL_TEST01_STATUS_REG_CHN2_ADDR);
read_status (MCNTRL_TEST01_STATUS_REG_CHN3_ADDR); read_status (MCNTRL_TEST01_STATUS_REG_CHN3_ADDR);
read_status (MCNTRL_TEST01_STATUS_REG_CHN4_ADDR); read_status (MCNTRL_TEST01_STATUS_REG_CHN4_ADDR);
read_status (MEMBRIDGE_STATUS_REG);
end end
endtask endtask
...@@ -112,10 +114,11 @@ endtask ...@@ -112,10 +114,11 @@ endtask
program_status (MCNTRL_SCANLINE_CHN3_ADDR, MCNTRL_SCANLINE_STATUS_CNTRL, mode,seq_num); //MCNTRL_SCANLINE_STATUS_REG_CHN3_ADDR='h5, program_status (MCNTRL_SCANLINE_CHN3_ADDR, MCNTRL_SCANLINE_STATUS_CNTRL, mode,seq_num); //MCNTRL_SCANLINE_STATUS_REG_CHN3_ADDR='h5,
program_status (MCNTRL_TILED_CHN2_ADDR, MCNTRL_TILED_STATUS_CNTRL, mode,seq_num); //MCNTRL_TILED_STATUS_REG_CHN4_ADDR= 'h6, program_status (MCNTRL_TILED_CHN2_ADDR, MCNTRL_TILED_STATUS_CNTRL, mode,seq_num); //MCNTRL_TILED_STATUS_REG_CHN4_ADDR= 'h6,
program_status (MCNTRL_TILED_CHN4_ADDR, MCNTRL_TILED_STATUS_CNTRL, mode,seq_num); //MCNTRL_TILED_STATUS_REG_CHN4_ADDR= 'h6, program_status (MCNTRL_TILED_CHN4_ADDR, MCNTRL_TILED_STATUS_CNTRL, mode,seq_num); //MCNTRL_TILED_STATUS_REG_CHN4_ADDR= 'h6,
program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN1_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN2_ADDR= 'h3c, // program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN1_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN2_ADDR= 'h3c,
program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN2_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN2_ADDR= 'h3c, program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN2_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN2_ADDR= 'h3c,
program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN3_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN3_ADDR= 'h3d, program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN3_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN3_ADDR= 'h3d,
program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN4_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e, program_status (MCNTRL_TEST01_ADDR, MCNTRL_TEST01_CHN4_STATUS_CNTRL,mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e,
program_status (MEMBRIDGE_ADDR , MEMBRIDGE_STATUS_CNTRL, mode,seq_num); //MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3e,
end end
endtask endtask
......
...@@ -352,12 +352,12 @@ fifo_same_clock_fill #( .DATA_WIDTH(8),.DATA_DEPTH(5)) ...@@ -352,12 +352,12 @@ fifo_same_clock_fill #( .DATA_WIDTH(8),.DATA_DEPTH(5))
.num_in_fifo() // wresp_num_in_fifo) // output[3:0] .num_in_fifo() // wresp_num_in_fifo) // output[3:0]
); );
assign wresp_re=bready && bvalid && !was_wresp_re; assign wresp_re=bready && bvalid; // && !was_wresp_re;
always @ (posedge rst or posedge aclk) begin always @ (posedge rst or posedge aclk) begin
if (rst) was_wresp_re<=0; if (rst) was_wresp_re<=0;
else was_wresp_re <= wresp_re; else was_wresp_re <= wresp_re;
end end
assign bvalid=|wresp_num_in_fifo[5:1] || !was_wresp_re; assign bvalid=|wresp_num_in_fifo[5:1] || (!was_wresp_re && wresp_num_in_fifo[0]);
// second wresp FIFO (does it exist in the actual module)? // second wresp FIFO (does it exist in the actual module)?
fifo_same_clock_fill #( .DATA_WIDTH(8),.DATA_DEPTH(5)) fifo_same_clock_fill #( .DATA_WIDTH(8),.DATA_DEPTH(5))
wresp_i ( wresp_i (
......
...@@ -48,6 +48,7 @@ module fifo_same_clock_fill ...@@ -48,6 +48,7 @@ module fifo_same_clock_fill
//ISExst: FF/Latch ddrc_test01.axibram_write_i.wdata_i.fill[4] has a constant value of 0 in block <ddrc_test01>. This FF/Latch will be trimmed during the optimization process. //ISExst: FF/Latch ddrc_test01.axibram_write_i.wdata_i.fill[4] has a constant value of 0 in block <ddrc_test01>. This FF/Latch will be trimmed during the optimization process.
// Do not understand - why? // Do not understand - why?
reg [DATA_DEPTH: 0] fill=0; // RAM fill reg [DATA_DEPTH: 0] fill=0; // RAM fill
reg [DATA_DEPTH: 0] fifo_fill=0; // FIFO (RAM+reg) fill
reg [DATA_WIDTH-1:0] inreg; reg [DATA_WIDTH-1:0] inreg;
reg [DATA_WIDTH-1:0] outreg; reg [DATA_WIDTH-1:0] outreg;
reg [DATA_DEPTH-1:0] ra; reg [DATA_DEPTH-1:0] ra;
...@@ -64,12 +65,18 @@ module fifo_same_clock_fill ...@@ -64,12 +65,18 @@ module fifo_same_clock_fill
assign rem= ram_nempty && (re || !out_full); assign rem= ram_nempty && (re || !out_full);
assign data_out=outreg; assign data_out=outreg;
assign nempty=out_full; assign nempty=out_full;
assign num_in_fifo=fill[DATA_DEPTH:0]; // assign num_in_fifo=fill[DATA_DEPTH:0];
assign num_in_fifo=fifo_fill[DATA_DEPTH:0];
always @ (posedge clk or posedge rst) begin always @ (posedge clk or posedge rst) begin
if (rst) fill <= 0; if (rst) fill <= 0;
else if (sync_rst) fill <= 0; else if (sync_rst) fill <= 0;
else fill <= next_fill; else fill <= next_fill;
if (rst) fifo_fill <= 0;
else if (sync_rst) fifo_fill <= 0;
else if ( we && !re) fifo_fill <= fifo_fill+1;
else if (!we && re) fifo_fill <= fifo_fill-1;
if (rst) wem <= 0; if (rst) wem <= 0;
else if (sync_rst) wem <= 0; else if (sync_rst) wem <= 0;
else wem <= we; else wem <= we;
......
...@@ -383,12 +383,12 @@ BUFG bufg_axi_aclk_i (.O(axi_aclk),.I(fclk[0])); ...@@ -383,12 +383,12 @@ BUFG bufg_axi_aclk_i (.O(axi_aclk),.I(fclk[0]));
.status_ad (status_test01_ad), // output[7:0] .status_ad (status_test01_ad), // output[7:0]
.status_rq (status_test01_rq), // output .status_rq (status_test01_rq), // output
.status_start (status_test01_start), // input .status_start (status_test01_start), // input
.frame_start_chn1 (frame_start_chn1), // output .frame_start_chn1 (), //frame_start_chn1), // output
.next_page_chn1 (next_page_chn1), // output .next_page_chn1 (), //next_page_chn1), // output
.page_ready_chn1 (page_ready_chn1), // input .page_ready_chn1 (1'b0), // page_ready_chn1), // input
.frame_done_chn1 (frame_done_chn1), // input .frame_done_chn1 (1'b0), //frame_done_chn1), // input
.line_unfinished_chn1 (line_unfinished_chn1), // input[15:0] .line_unfinished_chn1 (16'b0), //line_unfinished_chn1), // input[15:0]
.suspend_chn1 (suspend_chn1), // output .suspend_chn1 (), //suspend_chn1), // output
.frame_start_chn2 (frame_start_chn2), // output .frame_start_chn2 (frame_start_chn2), // output
.next_page_chn2 (next_page_chn2), // output .next_page_chn2 (next_page_chn2), // output
.page_ready_chn2 (page_ready_chn2), // input .page_ready_chn2 (page_ready_chn2), // input
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -39,8 +39,11 @@ ...@@ -39,8 +39,11 @@
`define TEST_TILED_WRITE_WAIT 1 // wait TEST_SCANLINE_WRITE finished (frame_done) `define TEST_TILED_WRITE_WAIT 1 // wait TEST_SCANLINE_WRITE finished (frame_done)
//`define TEST_TILED_READ 1 //`define TEST_TILED_READ 1
`define TEST_TILED_WRITE32 1 //`define TEST_TILED_WRITE32 1
`define TEST_TILED_READ32 1 //`define TEST_TILED_READ32 1
`define TEST_AFI_WRITE 1
`define TEST_AFI_READ 1
module x393_testbench01 #( module x393_testbench01 #(
`include "includes/x393_parameters.vh" // SuppressThisWarning VEditor - not used `include "includes/x393_parameters.vh" // SuppressThisWarning VEditor - not used
...@@ -81,34 +84,63 @@ module x393_testbench01 #( ...@@ -81,34 +84,63 @@ module x393_testbench01 #(
// wire MEMCLK; // wire MEMCLK;
// axi_hp simulation signals // axi_hp simulation signals
reg [31:0] afi_reg_addr; wire HCLK;
reg afi_reg_wr;
reg afi_reg_rd;
reg [31:0] afi_reg_din;
wire [31:0] afi_reg_dout;
wire [31:0] afi_sim_rd_address; // output[31:0] wire [31:0] afi_sim_rd_address; // output[31:0]
wire [ 5:0] afi_sim_rid; // output[5:0] wire [ 5:0] afi_sim_rid; // output[5:0] SuppressThisWarning VEditor - not used - just view
reg afi_sim_rd_valid; // input // reg afi_sim_rd_valid; // input
wire afi_sim_rd_valid; // input
wire afi_sim_rd_ready; // output wire afi_sim_rd_ready; // output
reg [63:0] afi_sim_rd_data; // input[63:0] // reg [63:0] afi_sim_rd_data; // input[63:0]
wire [ 2:0] afi_sim_rd_cap; // output[2:0] wire [63:0] afi_sim_rd_data; // input[63:0]
wire [ 3:0] afi_sim_rd_qos; // output[3:0] wire [ 2:0] afi_sim_rd_cap; // output[2:0] SuppressThisWarning VEditor - not used - just view
reg [ 1:0] afi_sim_rd_resp; // input[1:0] wire [ 3:0] afi_sim_rd_qos; // output[3:0] SuppressThisWarning VEditor - not used - just view
wire [ 1:0] afi_sim_rd_resp; // input[1:0]
// reg [ 1:0] afi_sim_rd_resp; // input[1:0]
wire [31:0] afi_sim_wr_address; // output[31:0] wire [31:0] afi_sim_wr_address; // output[31:0] SuppressThisWarning VEditor - not used - just view
wire [ 5:0] afi_sim_wid; // output[5:0] wire [ 5:0] afi_sim_wid; // output[5:0] SuppressThisWarning VEditor - not used - just view
wire afi_sim_wr_valid; // output wire afi_sim_wr_valid; // output
reg afi_sim_wr_ready; // input wire afi_sim_wr_ready; // input
wire [63:0] afi_sim_wr_data; // output[63:0] // reg afi_sim_wr_ready; // input
wire [ 7:0] afi_sim_wr_stb; // output[7:0] wire [63:0] afi_sim_wr_data; // output[63:0] SuppressThisWarning VEditor - not used - just view
reg [ 3:0] afi_sim_bresp_latency; // input[3:0] wire [ 7:0] afi_sim_wr_stb; // output[7:0] SuppressThisWarning VEditor - not used - just view
wire [ 2:0] afi_sim_wr_cap; // output[2:0] wire [ 3:0] afi_sim_bresp_latency; // input[3:0]
wire [ 3:0] afi_sim_wr_qos; // output[3:0] // reg [ 3:0] afi_sim_bresp_latency; // input[3:0]
wire [ 2:0] afi_sim_wr_cap; // output[2:0] SuppressThisWarning VEditor - not used - just view
wire [ 3:0] afi_sim_wr_qos; // output[3:0] SuppressThisWarning VEditor - not used - just view
assign HCLK = x393_i.ps7_i.SAXIHP0ACLK; // shortcut name
// afi loopback
assign #1 afi_sim_rd_data= {2'h0,afi_sim_rd_address[31:3],1'h1, 2'h0,afi_sim_rd_address[31:3],1'h0};
assign #1 afi_sim_rd_valid = afi_sim_rd_ready;
assign #1 afi_sim_rd_resp = afi_sim_rd_ready?2'b0:2'bx;
assign #1 afi_sim_wr_ready = afi_sim_wr_valid;
assign #1 afi_sim_bresp_latency=4'h5;
// axi_hp register access
// PS memory mapped registers to read/write over a separate simulation bus running at HCLK, no waits
reg [31:0] PS_REG_ADDR;
reg PS_REG_WR;
reg PS_REG_RD;
reg [31:0] PS_REG_DIN;
wire [31:0] PS_REG_DOUT;
reg [31:0] PS_RDATA; // SuppressThisWarning VEditor - not used - just view
/*
reg [31:0] afi_reg_addr;
reg afi_reg_wr;
reg afi_reg_rd;
reg [31:0] afi_reg_din;
wire [31:0] afi_reg_dout;
reg [31:0] AFI_REG_RD; // SuppressThisWarning VEditor - not used - just view
*/
initial begin
PS_REG_ADDR <= 'bx;
PS_REG_WR <= 0;
PS_REG_RD <= 0;
PS_REG_DIN <= 'bx;
PS_RDATA <= 'bx;
end
always @ (posedge HCLK) if (PS_REG_RD) PS_RDATA <= PS_REG_DOUT;
reg [639:0] TEST_TITLE; reg [639:0] TEST_TITLE;
// Simulation signals // Simulation signals
...@@ -408,7 +440,7 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK; ...@@ -408,7 +440,7 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK;
TEST_TITLE = "SCANLINE_WRITE"; TEST_TITLE = "SCANLINE_WRITE";
$display("===================== TEST_%s =========================",TEST_TITLE); $display("===================== TEST_%s =========================",TEST_TITLE);
test_scanline_write( test_scanline_write(
1, // valid: 1 or 3 input [3:0] channel; 3, // valid: 1 or 3 input [3:0] channel; now - 3 only, 1 is for afi
SCANLINE_EXTRA_PAGES, // input [1:0] extra_pages; SCANLINE_EXTRA_PAGES, // input [1:0] extra_pages;
1, // input wait_done; 1, // input wait_done;
WINDOW_WIDTH, WINDOW_WIDTH,
...@@ -421,7 +453,7 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK; ...@@ -421,7 +453,7 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK;
TEST_TITLE = "SCANLINE_READ"; TEST_TITLE = "SCANLINE_READ";
$display("===================== TEST_%s =========================",TEST_TITLE); $display("===================== TEST_%s =========================",TEST_TITLE);
test_scanline_read ( test_scanline_read (
1, // valid: 1 or 3 input [3:0] channel; 3, // valid: 1 or 3 input [3:0] channel; now - 3 only, 1 is for afi
SCANLINE_EXTRA_PAGES, // input [1:0] extra_pages; SCANLINE_EXTRA_PAGES, // input [1:0] extra_pages;
1, // input show_data; 1, // input show_data;
WINDOW_WIDTH, WINDOW_WIDTH,
...@@ -503,6 +535,44 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK; ...@@ -503,6 +535,44 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK;
TILE_HEIGHT, TILE_HEIGHT,
TILE_VSTEP); TILE_VSTEP);
`endif `endif
`ifdef TEST_AFI_WRITE
TEST_TITLE = "AFI_WRITE";
$display("===================== TEST_%s =========================",TEST_TITLE);
test_afi_rw (
1, // write_ddr3;
SCANLINE_EXTRA_PAGES,// extra_pages;
FRAME_START_ADDRESS, // input [21:0] frame_start_addr;
FRAME_FULL_WIDTH, // input [15:0] window_full_width; // 13 bit - in 8*16=128 bit bursts
WINDOW_WIDTH, // input [15:0] window_width; // 13 bit - in 8*16=128 bit bursts
WINDOW_HEIGHT, // input [15:0] window_height; // 16 bit (only 14 are used here)
WINDOW_X0, // input [15:0] window_left;
WINDOW_Y0, // input [15:0] window_top;
0, // input [28:0] start64; // relative start adderss of the transfer (set to 0 when writing lo_addr64)
AFI_LO_ADDR64, // input [28:0] lo_addr64; // low address of the system memory range, in 64-bit words
AFI_SIZE64, // input [28:0] size64; // size of the system memory range in 64-bit words
0); // input continue; // 0 start from start64, 1 - continue from where it was
`endif
`ifdef TEST_AFI_READ
TEST_TITLE = "AFI_READ";
$display("===================== TEST_%s =========================",TEST_TITLE);
test_afi_rw (
0, // write_ddr3;
SCANLINE_EXTRA_PAGES,// extra_pages;
FRAME_START_ADDRESS, // input [21:0] frame_start_addr;
FRAME_FULL_WIDTH, // input [15:0] window_full_width; // 13 bit - in 8*16=128 bit bursts
WINDOW_WIDTH, // input [15:0] window_width; // 13 bit - in 8*16=128 bit bursts
WINDOW_HEIGHT, // input [15:0] window_height; // 16 bit (only 14 are used here)
WINDOW_X0, // input [15:0] window_left;
WINDOW_Y0, // input [15:0] window_top;
0, // input [28:0] start64; // relative start adderss of the transfer (set to 0 when writing lo_addr64)
AFI_LO_ADDR64, // input [28:0] lo_addr64; // low address of the system memory range, in 64-bit words
AFI_SIZE64, // input [28:0] size64; // size of the system memory range in 64-bit words
0); // input continue; // 0 start from start64, 1 - continue from where it was
`endif
TEST_TITLE = "ALL_DONE"; TEST_TITLE = "ALL_DONE";
$display("===================== TEST_%s =========================",TEST_TITLE); $display("===================== TEST_%s =========================",TEST_TITLE);
#20000; #20000;
...@@ -510,11 +580,8 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK; ...@@ -510,11 +580,8 @@ always #(CLKIN_PERIOD/2) CLK = ~CLK;
end end
// protect from never end // protect from never end
initial begin initial begin
// #10000000; // #200000;
#200000; #50000;
// #42000;
// #100000;
// #60000;
$display("finish testbench 2"); $display("finish testbench 2");
$finish; $finish;
end end
...@@ -1138,17 +1205,17 @@ simul_axi_hp_rd #( ...@@ -1138,17 +1205,17 @@ simul_axi_hp_rd #(
.sim_rd_cap (afi_sim_rd_cap), // output[2:0] .sim_rd_cap (afi_sim_rd_cap), // output[2:0]
.sim_rd_qos (afi_sim_rd_qos), // output[3:0] .sim_rd_qos (afi_sim_rd_qos), // output[3:0]
.sim_rd_resp (afi_sim_rd_resp), // input[1:0] .sim_rd_resp (afi_sim_rd_resp), // input[1:0]
.reg_addr (afi_reg_addr), // input[31:0] .reg_addr (PS_REG_ADDR), // input[31:0]
.reg_wr (afi_reg_wr), // input .reg_wr (PS_REG_WR), // input
.reg_rd (afi_reg_rd), // input .reg_rd (PS_REG_RD), // input
.reg_din (afi_reg_din), // input[31:0] .reg_din (PS_REG_DIN), // input[31:0]
.reg_dout (afi_reg_dout) // output[31:0] .reg_dout (PS_REG_DOUT) // output[31:0]
); );
simul_axi_hp_wr #( simul_axi_hp_wr #(
.HP_PORT(0) .HP_PORT(0)
) simul_axi_hp_wr_i ( ) simul_axi_hp_wr_i (
.rst (), // input .rst (RST), // input
.aclk (x393_i.ps7_i.SAXIHP0ACLK), // input .aclk (x393_i.ps7_i.SAXIHP0ACLK), // input
.aresetn (), // output .aresetn (), // output
.awaddr (x393_i.ps7_i.SAXIHP0AWADDR), // input[31:0] .awaddr (x393_i.ps7_i.SAXIHP0AWADDR), // input[31:0]
...@@ -1184,11 +1251,11 @@ simul_axi_hp_wr #( ...@@ -1184,11 +1251,11 @@ simul_axi_hp_wr #(
.sim_bresp_latency(afi_sim_bresp_latency), // input[3:0] .sim_bresp_latency(afi_sim_bresp_latency), // input[3:0]
.sim_wr_cap (afi_sim_wr_cap), // output[2:0] .sim_wr_cap (afi_sim_wr_cap), // output[2:0]
.sim_wr_qos (afi_sim_wr_qos), // output[3:0] .sim_wr_qos (afi_sim_wr_qos), // output[3:0]
.reg_addr (afi_reg_addr), // input[31:0] .reg_addr (PS_REG_ADDR), // input[31:0]
.reg_wr (afi_reg_wr), // input .reg_wr (PS_REG_WR), // input
.reg_rd (afi_reg_rd), // input .reg_rd (PS_REG_RD), // input
.reg_din (afi_reg_din), // input[31:0] .reg_din (PS_REG_DIN), // input[31:0]
.reg_dout (afi_reg_dout) // output[31:0] .reg_dout (PS_REG_DOUT) // output[31:0]
); );
...@@ -1338,12 +1405,169 @@ task test_read_block; // SuppressThisWarning VEditor - may be unused ...@@ -1338,12 +1405,169 @@ task test_read_block; // SuppressThisWarning VEditor - may be unused
end end
endtask endtask
task membridge_setup;
input [28:0] len64; // number of 64-bit words to transfer
input [28:0] width64; // frame width in 64-bit words
input [28:0] start64; // relative start adderss of the transfer (set to 0 when writing lo_addr64)
input [28:0] lo_addr64; // low address of the system memory range, in 64-bit words
input [28:0] size64; // size of the system memory range in 64-bit words
begin
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_LO_ADDR64, {3'b0,lo_addr64});
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_SIZE64, {3'b0,size64});
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_START64, {3'b0,start64});
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_LEN64, {3'b0,len64});
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_WIDTH64, {3'b0,width64});
end
endtask
task membridge_start;
input continue; // 0 start from start64, 1 - continue from where it was
begin
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_CTRL, {29'b0,continue,2'b11});
end
endtask
task membridge_en; // SuppressThisWarning VEditor - may be unused
input en; // not needed to start, pauses axi if set to 0 whil running, resets "done" status bit
begin
write_contol_register(MEMBRIDGE_ADDR + MEMBRIDGE_CTRL, {31'b0,en});
end
endtask
task afi_setup;
input [1:0] port_num;
begin
afi_write_reg(port_num, 'h0, 0); // AFI_RDCHAN_CTRL
afi_write_reg(port_num, 'h4, 7); // AFI_RDCHAN_ISSUINGCAP
afi_write_reg(port_num, 'h8, 0); // AFI_RDQOS
//afi_write_reg(port_num, 'hc, 0); // AFI_RDDATAFIFO_LEVEL
//afi_write_reg(port_num, 'h10, 0); // AFI_RDDEBUG
afi_write_reg(port_num, 'h14, 'hf00); // AFI_WRCHAN_CTRL
afi_write_reg(port_num, 'h18, 0); // AFI_WRCHAN_ISSUINGCAP
afi_write_reg(port_num, 'h1c, 0); // AFI_WRQOS
//afi_write_reg(port_num, 'h20, 0); // AFI_WRDATAFIFO_LEVEL
//afi_write_reg(port_num, 'h24, 0); // AFI_WRDEBUG
end
endtask
task afi_write_reg;
input [1:0] port_num;
input integer rel_baddr; // relative byte address
input [31:0] data;
begin
ps_write_reg(32'hf8008000+ (port_num << 12) + (rel_baddr & 'hfffffffc), data);
end
endtask
task afi_read_reg; // SuppressThisWarning VEditor - may be unused
input [1:0] port_num;
input integer rel_baddr; // relative byte address
input verbose;
begin
ps_read_reg(32'hf8008000+ (port_num << 12) + (rel_baddr & 'hfffffffc), verbose);
end
endtask
task ps_write_reg;
input [31:0] ps_reg_addr;
input [31:0] ps_reg_data;
begin
@(posedge HCLK);
PS_REG_ADDR <= ps_reg_addr;
PS_REG_DIN <= ps_reg_data;
PS_REG_WR <= 1'b1;
@(posedge HCLK);
PS_REG_ADDR <= 'bx;
PS_REG_DIN <= 'bx;
PS_REG_WR <= 1'b0;
end
endtask
task ps_read_reg;
input [31:0] ps_reg_addr;
input verbose;
begin
@(posedge HCLK);
PS_REG_ADDR <= ps_reg_addr;
PS_REG_RD <= 1'b1;
@(posedge HCLK);
PS_REG_ADDR <= 'bx;
PS_REG_DIN <= 'bx;
PS_REG_WR <= 1'b0;
@(negedge HCLK);
if (verbose) begin
$display("ps_read_reg(%x) -> %x @%t",ps_reg_addr,PS_RDATA,$time);
end
end
endtask
// above - move to include
task test_afi_rw; // SuppressThisWarning VEditor - may be unused
input write_ddr3;
input [1:0] extra_pages;
input [21:0] frame_start_addr;
input [15:0] window_full_width; // 13 bit - in 8*16=128 bit bursts
input [15:0] window_width; // 13 bit - in 8*16=128 bit bursts
input [15:0] window_height; // 16 bit (only 14 are used here)
input [15:0] window_left;
input [15:0] window_top;
input [28:0] start64; // relative start adderss of the transfer (set to 0 when writing lo_addr64)
input [28:0] lo_addr64; // low address of the system memory range, in 64-bit words
input [28:0] size64; // size of the system memory range in 64-bit words
input continue; // 0 start from start64, 1 - continue from where it was
// -----------------------------------------
integer mode;
begin
$display("====== test_afi_rw: write=%d, extra_pages=%d, frame_start= %x, window_full_width=%d, window_width=%d, window_height=%d, window_left=%d, window_top=%d,@%t",
write_ddr3, extra_pages, frame_start_addr, window_full_width, window_width, window_height, window_left, window_top, $time);
$display("len64=%x, width64=%x, start64=%x, lo_addr64=%x, size64=%x,@%t",
((window_width[12:0]==0)? 15'h4000 : {1'b0,window_width[12:0],1'b0})*window_height[13:0],
(window_width[12:0]==0)? 29'h4000 : {15'b0,window_width[12:0],1'b0},
start64, lo_addr64, size64, $time);
mode= func_encode_mode_scanline(
extra_pages,
write_ddr3, // write_mem,
1, // enable
0); // chn_reset
write_contol_register(MCNTRL_SCANLINE_CHN1_ADDR + MCNTRL_SCANLINE_STARTADDR, {10'b0,frame_start_addr}); // RA=80, CA=0, BA=0 22-bit frame start address (3 CA LSBs==0. BA==0)
write_contol_register(MCNTRL_SCANLINE_CHN1_ADDR + MCNTRL_SCANLINE_FRAME_FULL_WIDTH, {16'h0, window_full_width});
write_contol_register(MCNTRL_SCANLINE_CHN1_ADDR + MCNTRL_SCANLINE_WINDOW_WH, {window_height,window_width}); //WINDOW_WIDTH + (WINDOW_HEIGHT<<16));
write_contol_register(MCNTRL_SCANLINE_CHN1_ADDR + MCNTRL_SCANLINE_WINDOW_X0Y0, {window_top,window_left}); //WINDOW_X0+ (WINDOW_Y0<<16));
write_contol_register(MCNTRL_SCANLINE_CHN1_ADDR + MCNTRL_SCANLINE_WINDOW_STARTXY, 0);
write_contol_register(MCNTRL_SCANLINE_CHN1_ADDR + MCNTRL_SCANLINE_MODE, mode);
configure_channel_priority(1,0); // lowest priority channel 3
enable_memcntrl_en_dis(1,1);
// write_contol_register(test_mode_address, TEST01_START_FRAME);
afi_setup(0);
membridge_setup(
((window_width[12:0]==0)? 15'h4000 : {1'b0,window_width[12:0],1'b0})*window_height[13:0], //len64,
(window_width[12:0]==0)? 29'h4000 : {15'b0,window_width[12:0],1'b0}, // width64,
start64,
lo_addr64,
size64);
membridge_start (continue);
// just wait done
wait_status_condition ( // may also be read directly from the same bit of mctrl_linear_rw (address=5) status
MEMBRIDGE_STATUS_REG, // MCNTRL_TEST01_STATUS_REG_CHN3_ADDR,
MCNTRL_SCANLINE_CHN1_ADDR + MEMBRIDGE_STATUS_CNTRL, // MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN3_STATUS_CNTRL,
DEFAULT_STATUS_MODE,
2 << STATUS_2LSB_SHFT, // bit 24 - busy, bit 25 - frame done
2 << STATUS_2LSB_SHFT, // mask for the 4-bit page number
0, // equal to
0); // no need to synchronize sequence number
end
endtask
task test_scanline_write; // SuppressThisWarning VEditor - may be unused task test_scanline_write; // SuppressThisWarning VEditor - may be unused
input [3:0] channel; input [3:0] channel;
input [1:0] extra_pages; input [1:0] extra_pages;
input wait_done; input wait_done;
input [15:0] window_width; input [15:0] window_width; // 13 bit - in 8*16=128 bit bursts
input [15:0] window_height; input [15:0] window_height; // 16 bit
input [15:0] window_left; input [15:0] window_left;
input [15:0] window_top; input [15:0] window_top;
...@@ -1363,12 +1587,12 @@ task test_scanline_write; // SuppressThisWarning VEditor - may be unused ...@@ -1363,12 +1587,12 @@ task test_scanline_write; // SuppressThisWarning VEditor - may be unused
$display("====== test_scanline_write: channel=%d, extra_pages=%d, wait_done=%d @%t", $display("====== test_scanline_write: channel=%d, extra_pages=%d, wait_done=%d @%t",
channel, extra_pages, wait_done, $time); channel, extra_pages, wait_done, $time);
case (channel) case (channel)
1: begin // 1: begin
start_addr= MCNTRL_SCANLINE_CHN1_ADDR; // start_addr= MCNTRL_SCANLINE_CHN1_ADDR;
status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR; // status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR;
status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL; // status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL;
test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE; // test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE;
end // end
3: begin 3: begin
start_addr= MCNTRL_SCANLINE_CHN3_ADDR; start_addr= MCNTRL_SCANLINE_CHN3_ADDR;
status_address= MCNTRL_TEST01_STATUS_REG_CHN3_ADDR; status_address= MCNTRL_TEST01_STATUS_REG_CHN3_ADDR;
...@@ -1376,8 +1600,8 @@ task test_scanline_write; // SuppressThisWarning VEditor - may be unused ...@@ -1376,8 +1600,8 @@ task test_scanline_write; // SuppressThisWarning VEditor - may be unused
test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN3_MODE; test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN3_MODE;
end end
default: begin default: begin
$display("**** ERROR: Invalid channel, only 1 and 3 are valid"); $display("**** ERROR: Invalid channel, only 3 is valid");
start_addr= MCNTRL_SCANLINE_CHN1_ADDR; start_addr= MCNTRL_SCANLINE_CHN3_ADDR;
status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR; status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR;
status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL; status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL;
test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE; test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE;
...@@ -1389,7 +1613,7 @@ task test_scanline_write; // SuppressThisWarning VEditor - may be unused ...@@ -1389,7 +1613,7 @@ task test_scanline_write; // SuppressThisWarning VEditor - may be unused
1, // enable 1, // enable
0); // chn_reset 0); // chn_reset
write_contol_register(start_addr+ MCNTRL_SCANLINE_STARTADDR, FRAME_START_ADDRESS); // RA=80, CA=0, BA=0 22-bit frame start address (3 CA LSBs==0. BA==0) write_contol_register(start_addr + MCNTRL_SCANLINE_STARTADDR, FRAME_START_ADDRESS); // RA=80, CA=0, BA=0 22-bit frame start address (3 CA LSBs==0. BA==0)
write_contol_register(start_addr + MCNTRL_SCANLINE_FRAME_FULL_WIDTH, FRAME_FULL_WIDTH); write_contol_register(start_addr + MCNTRL_SCANLINE_FRAME_FULL_WIDTH, FRAME_FULL_WIDTH);
write_contol_register(start_addr + MCNTRL_SCANLINE_WINDOW_WH, {window_height,window_width}); //WINDOW_WIDTH + (WINDOW_HEIGHT<<16)); write_contol_register(start_addr + MCNTRL_SCANLINE_WINDOW_WH, {window_height,window_width}); //WINDOW_WIDTH + (WINDOW_HEIGHT<<16));
write_contol_register(start_addr + MCNTRL_SCANLINE_WINDOW_X0Y0, {window_top,window_left}); //WINDOW_X0+ (WINDOW_Y0<<16)); write_contol_register(start_addr + MCNTRL_SCANLINE_WINDOW_X0Y0, {window_top,window_left}); //WINDOW_X0+ (WINDOW_Y0<<16));
...@@ -1491,12 +1715,12 @@ task test_scanline_read; // SuppressThisWarning VEditor - may be unused ...@@ -1491,12 +1715,12 @@ task test_scanline_read; // SuppressThisWarning VEditor - may be unused
$display("====== test_scanline_read: channel=%d, extra_pages=%d, show_data=%d @%t", $display("====== test_scanline_read: channel=%d, extra_pages=%d, show_data=%d @%t",
channel, extra_pages, show_data, $time); channel, extra_pages, show_data, $time);
case (channel) case (channel)
1: begin // 1: begin
start_addr= MCNTRL_SCANLINE_CHN1_ADDR; // start_addr= MCNTRL_SCANLINE_CHN1_ADDR;
status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR; // status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR;
status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL; // status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL;
test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE; // test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE;
end // end
3: begin 3: begin
start_addr= MCNTRL_SCANLINE_CHN3_ADDR; start_addr= MCNTRL_SCANLINE_CHN3_ADDR;
status_address= MCNTRL_TEST01_STATUS_REG_CHN3_ADDR; status_address= MCNTRL_TEST01_STATUS_REG_CHN3_ADDR;
...@@ -1504,8 +1728,8 @@ task test_scanline_read; // SuppressThisWarning VEditor - may be unused ...@@ -1504,8 +1728,8 @@ task test_scanline_read; // SuppressThisWarning VEditor - may be unused
test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN3_MODE; test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN3_MODE;
end end
default: begin default: begin
$display("**** ERROR: Invalid channel, only 1 and 3 are valid"); $display("**** ERROR: Invalid channel, only 3 is valid");
start_addr= MCNTRL_SCANLINE_CHN1_ADDR; start_addr= MCNTRL_SCANLINE_CHN3_ADDR;
status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR; status_address= MCNTRL_TEST01_STATUS_REG_CHN1_ADDR;
status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL; status_control_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_STATUS_CNTRL;
test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE; test_mode_address= MCNTRL_TEST01_ADDR + MCNTRL_TEST01_CHN1_MODE;
...@@ -1827,12 +2051,12 @@ task write_block_scanline_chn; // S uppressThisWarning VEditor : may be unused ...@@ -1827,12 +2051,12 @@ task write_block_scanline_chn; // S uppressThisWarning VEditor : may be unused
$display("====== write_block_scanline_chn:%d page: %x X=0x%x Y=0x%x num=%d @%t", chn, page, startX, startY,num_bursts, $time); $display("====== write_block_scanline_chn:%d page: %x X=0x%x Y=0x%x num=%d @%t", chn, page, startX, startY,num_bursts, $time);
case (chn) case (chn)
0: start_addr=MCONTR_BUF0_WR_ADDR + (page << 8); 0: start_addr=MCONTR_BUF0_WR_ADDR + (page << 8);
1: start_addr=MCONTR_BUF1_WR_ADDR + (page << 8); // 1: start_addr=MCONTR_BUF1_WR_ADDR + (page << 8);
2: start_addr=MCONTR_BUF2_WR_ADDR + (page << 8); 2: start_addr=MCONTR_BUF2_WR_ADDR + (page << 8);
3: start_addr=MCONTR_BUF3_WR_ADDR + (page << 8); 3: start_addr=MCONTR_BUF3_WR_ADDR + (page << 8);
4: start_addr=MCONTR_BUF4_WR_ADDR + (page << 8); 4: start_addr=MCONTR_BUF4_WR_ADDR + (page << 8);
default: begin default: begin
$display("**** ERROR: Invalid channel for write_block_scanline_chn = %d @%t", chn, $time); $display("**** ERROR: Invalid channel (not 0,2,3,4) for write_block_scanline_chn = %d @%t", chn, $time);
start_addr = MCONTR_BUF0_WR_ADDR+ (page << 8); start_addr = MCONTR_BUF0_WR_ADDR+ (page << 8);
end end
endcase endcase
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment