Commit b721ae66 authored by Andrey Filippov's avatar Andrey Filippov

continue playing

parent b5aa2398
...@@ -25,20 +25,16 @@ module axibram_read #( ...@@ -25,20 +25,16 @@ module axibram_read #(
parameter ADDRESS_BITS = 10 // number of memory address bits parameter ADDRESS_BITS = 10 // number of memory address bits
)( )(
input aclk, // clock - should be buffered input aclk, // clock - should be buffered
// input aresetn, // reset, active low // input rst, // reset, active high
input rst, // reset, active high input arst, // @posedge aclk sync reset, active high
// AXI Read Address // AXI Read Address
input [31:0] araddr, // ARADDR[31:0], input input [31:0] araddr, // ARADDR[31:0], input
input arvalid, // ARVALID, input input arvalid, // ARVALID, input
output arready, // ARREADY, output output arready, // ARREADY, output
input [11:0] arid, // ARID[11:0], input input [11:0] arid, // ARID[11:0], input
// input [ 1:0] arlock, // ARLOCK[1:0], input
// input [ 3:0] archache,// ARCACHE[3:0], input
// input [ 2:0] arprot, // ARPROT[2:0], input
input [ 3:0] arlen, // ARLEN[3:0], input input [ 3:0] arlen, // ARLEN[3:0], input
input [ 1:0] arsize, // ARSIZE[1:0], input input [ 1:0] arsize, // ARSIZE[1:0], input
input [ 1:0] arburst, // ARBURST[1:0], input input [ 1:0] arburst, // ARBURST[1:0], input
// input [ 3:0] adqos, // ARQOS[3:0], input
// AXI Read Data // AXI Read Data
output [31:0] rdata, // RDATA[31:0], output output [31:0] rdata, // RDATA[31:0], output
output reg rvalid, // RVALID, output output reg rvalid, // RVALID, output
...@@ -145,30 +141,30 @@ module axibram_read #( ...@@ -145,30 +141,30 @@ module axibram_read #(
assign rdata[31:0] = bram_rdata; // data out assign rdata[31:0] = bram_rdata; // data out
always @ (posedge aclk or posedge rst) begin always @ (posedge aclk) begin
`ifdef USE_SHORT_REN_REGEN `ifdef USE_SHORT_REN_REGEN
if (rst) bram_regen_r <= 0; if (arst) bram_regen_r <= 0;
else bram_regen_r <= bram_ren; else bram_regen_r <= bram_ren;
`endif `endif
if (rst) pre_last_in_burst_r <= 0; if (arst) pre_last_in_burst_r <= 0;
// else if (start_read_burst_w) pre_last_in_burst_r <= (read_left==4'b0); // else if (start_read_burst_w) pre_last_in_burst_r <= (read_left==4'b0);
else if (bram_reg_re_w) pre_last_in_burst_r <= (read_left==4'b0); else if (bram_reg_re_w) pre_last_in_burst_r <= (read_left==4'b0);
if (rst) rburst[1:0] <= 0; if (arst) rburst[1:0] <= 0;
else if (start_read_burst_w) rburst[1:0] <= arburst_out[1:0]; else if (start_read_burst_w) rburst[1:0] <= arburst_out[1:0];
if (rst) rlen[3:0] <= 0; if (arst) rlen[3:0] <= 0;
else if (start_read_burst_w) rlen[3:0] <= arlen_out[3:0]; else if (start_read_burst_w) rlen[3:0] <= arlen_out[3:0];
if (rst) read_in_progress <= 0; if (arst) read_in_progress <= 0;
else read_in_progress <= read_in_progress_w; else read_in_progress <= read_in_progress_w;
if (rst) read_in_progress_d <= 0; if (arst) read_in_progress_d <= 0;
// else read_in_progress_d <= read_in_progress_d_w; // else read_in_progress_d <= read_in_progress_d_w;
else if (bram_reg_re_w) read_in_progress_d <= read_in_progress_d_w; else if (bram_reg_re_w) read_in_progress_d <= read_in_progress_d_w;
if (rst) read_in_progress_or <= 0; if (arst) read_in_progress_or <= 0;
// else read_in_progress_or <= read_in_progress_d_w || read_in_progress_w; // else read_in_progress_or <= read_in_progress_d_w || read_in_progress_w;
// else if (bram_reg_re_w) read_in_progress_or <= read_in_progress_d_w || read_in_progress_w; // else if (bram_reg_re_w) read_in_progress_or <= read_in_progress_d_w || read_in_progress_w;
// FIXME: // FIXME:
...@@ -177,22 +173,23 @@ module axibram_read #( ...@@ -177,22 +173,23 @@ module axibram_read #(
// reg read_in_progress_d=0; // delayed by one active cycle (not skipped) // reg read_in_progress_d=0; // delayed by one active cycle (not skipped)
// reg read_in_progress_or=0; // read_in_progress || read_in_progress_d // reg read_in_progress_or=0; // read_in_progress || read_in_progress_d
if (rst) read_left <= 0; if (arst) read_left <= 0;
else if (start_read_burst_w) read_left <= arlen_out[3:0]; // precedence over inc else if (start_read_burst_w) read_left <= arlen_out[3:0]; // precedence over inc
else if (bram_reg_re_w) read_left <= read_left-1; //SuppressThisWarning ISExst Result of 32-bit expression is truncated to fit in 4-bit target. else if (bram_reg_re_w) read_left <= read_left-1; //SuppressThisWarning ISExst Result of 32-bit expression is truncated to fit in 4-bit target.
if (rst) read_address <= {ADDRESS_BITS{1'b0}}; if (arst) read_address <= {ADDRESS_BITS{1'b0}};
else if (start_read_burst_w) read_address <= araddr_out[ADDRESS_BITS-1:0]; // precedence over inc else if (start_read_burst_w) read_address <= araddr_out[ADDRESS_BITS-1:0]; // precedence over inc
else if (bram_reg_re_w) read_address <= next_rd_address_w; else if (bram_reg_re_w) read_address <= next_rd_address_w;
if (rst) rvalid <= 1'b0; if (arst) rvalid <= 1'b0;
else if (bram_reg_re_w && read_in_progress_d) rvalid <= 1'b1; else if (bram_reg_re_w && read_in_progress_d) rvalid <= 1'b1;
else if (rready) rvalid <= 1'b0; else if (rready) rvalid <= 1'b0;
if (rst) rlast <= 1'b0; if (arst) rlast <= 1'b0;
else if (last_in_burst_d_w) rlast <= 1'b1; else if (last_in_burst_d_w) rlast <= 1'b1;
else if (rready) rlast <= 1'b0; else if (rready) rlast <= 1'b0;
end end
always @ (posedge aclk) begin //SuppressThisWarning ISExst Assignment to bram_reg_re_0 ignored, since the identifier is never used always @ (posedge aclk) begin //SuppressThisWarning ISExst Assignment to bram_reg_re_0 ignored, since the identifier is never used
// bram_reg_re_0 <= read_in_progress_w && !pre_rvalid_w; // bram_reg_re_0 <= read_in_progress_w && !pre_rvalid_w;
...@@ -240,9 +237,9 @@ module axibram_read #( ...@@ -240,9 +237,9 @@ module axibram_read #(
fifo_same_clock #( .DATA_WIDTH(ADDRESS_BITS+20),.DATA_DEPTH(4)) fifo_same_clock #( .DATA_WIDTH(ADDRESS_BITS+20),.DATA_DEPTH(4))
raddr_i ( raddr_i (
.rst(rst), .rst(1'b0),
.clk(aclk), .clk(aclk),
.sync_rst(1'b0), // input .sync_rst(arst),
.we(arvalid && arready), .we(arvalid && arready),
.re(start_read_burst_w), .re(start_read_burst_w),
.data_in({arid[11:0], arburst[1:0],arsize[1:0],arlen[3:0],araddr[ADDRESS_BITS+1:2]}), .data_in({arid[11:0], arburst[1:0],arsize[1:0],arlen[3:0],araddr[ADDRESS_BITS+1:2]}),
......
...@@ -26,21 +26,16 @@ module axibram_write #( ...@@ -26,21 +26,16 @@ module axibram_write #(
parameter ADDRESS_BITS = 10 // number of memory address bits parameter ADDRESS_BITS = 10 // number of memory address bits
)( )(
input aclk, // clock - should be buffered input aclk, // clock - should be buffered
// input aresetn, // reset, active low input arst, // @aclk sync reset, active high
input rst, // reset, active highw
// AXI Write Address // AXI Write Address
input [31:0] awaddr, // AWADDR[31:0], input input [31:0] awaddr, // AWADDR[31:0], input
input awvalid, // AWVALID, input input awvalid, // AWVALID, input
output awready, // AWREADY, output output awready, // AWREADY, output
input [11:0] awid, // AWID[11:0], input input [11:0] awid, // AWID[11:0], input
// input [ 1:0] awlock, // AWLOCK[1:0], input
// input [ 3:0] awcache, // AWCACHE[3:0], input
// input [ 2:0] awprot, // AWPROT[2:0], input
input [ 3:0] awlen, // AWLEN[3:0], input input [ 3:0] awlen, // AWLEN[3:0], input
input [ 1:0] awsize, // AWSIZE[1:0], input input [ 1:0] awsize, // AWSIZE[1:0], input
input [ 1:0] awburst, // AWBURST[1:0], input input [ 1:0] awburst, // AWBURST[1:0], input
// input [ 3:0] awqos, // AWQOS[3:0], input
// AXI PS Master GP0: Write Data // AXI PS Master GP0: Write Data
input [31:0] wdata, // WDATA[31:0], input input [31:0] wdata, // WDATA[31:0], input
input wvalid, // WVALID, input input wvalid, // WVALID, input
...@@ -141,45 +136,31 @@ module axibram_write #( ...@@ -141,45 +136,31 @@ module axibram_write #(
assign start_write_burst_w=w_nempty_ready && aw_nempty_ready && (!write_in_progress || (w_nempty_ready && ((write_left[3:0]==4'b0) || wlast_out))); assign start_write_burst_w=w_nempty_ready && aw_nempty_ready && (!write_in_progress || (w_nempty_ready && ((write_left[3:0]==4'b0) || wlast_out)));
assign write_in_progress_w=w_nempty_ready && aw_nempty_ready || (write_in_progress && !(w_nempty_ready && ((write_left[3:0]==4'b0) || wlast_out))); assign write_in_progress_w=w_nempty_ready && aw_nempty_ready || (write_in_progress && !(w_nempty_ready && ((write_left[3:0]==4'b0) || wlast_out)));
always @ (posedge aclk or posedge rst) begin always @ (posedge aclk) begin
if (rst) wburst[1:0] <= 0; if (arst) wburst[1:0] <= 0;
else if (start_write_burst_w) wburst[1:0] <= awburst_out[1:0]; else if (start_write_burst_w) wburst[1:0] <= awburst_out[1:0];
if (rst) wlen[3:0] <= 0; if (arst) wlen[3:0] <= 0;
else if (start_write_burst_w) wlen[3:0] <= awlen_out[3:0]; else if (start_write_burst_w) wlen[3:0] <= awlen_out[3:0];
if (rst) write_in_progress <= 0; if (arst) write_in_progress <= 0;
else write_in_progress <= write_in_progress_w; else write_in_progress <= write_in_progress_w;
if (rst) write_left <= 0; if (arst) write_left <= 0;
else if (start_write_burst_w) write_left <= awlen_out[3:0]; // precedence over inc else if (start_write_burst_w) write_left <= awlen_out[3:0]; // precedence over inc
else if (bram_we_w) write_left <= write_left-1; //SuppressThisWarning ISExst Result of 32-bit expression is truncated to fit in 4-bit target. else if (bram_we_w) write_left <= write_left-1; //SuppressThisWarning ISExst Result of 32-bit expression is truncated to fit in 4-bit target.
if (rst) write_address <= {ADDRESS_BITS{1'b0}}; if (arst) write_address <= {ADDRESS_BITS{1'b0}};
else if (start_write_burst_w) write_address <= awaddr_out[ADDRESS_BITS-1:0]; // precedence over inc else if (start_write_burst_w) write_address <= awaddr_out[ADDRESS_BITS-1:0]; // precedence over inc
else if (bram_we_w) write_address <= next_wr_address_w; else if (bram_we_w) write_address <= next_wr_address_w;
if (rst) dev_ready_r <= 1'b0; if (arst) dev_ready_r <= 1'b0;
else dev_ready_r <= dev_ready; else dev_ready_r <= dev_ready;
end end
// **** Write response channel **** // **** Write response channel ****
wire [ 1:0] bresp_in; wire [ 1:0] bresp_in;
assign bresp_in=2'b0; assign bresp_in=2'b0;
/*
output bvalid, // BVALID, output
input bready, // BREADY, input
output [11:0] bid, // BID[11:0], output
output [ 1:0] bresp // BRESP[1:0], output
*/
/*
reg bram_reg_re_r;
always @ (posedge aclk) begin
bram_reg_re_r <= bram_reg_re_w;
end
*/
// external memory interface (write only) // external memory interface (write only)
assign pre_awaddr=awaddr_out[ADDRESS_BITS-1:0]; assign pre_awaddr=awaddr_out[ADDRESS_BITS-1:0];
assign start_burst=start_write_burst_w; assign start_burst=start_write_burst_w;
...@@ -199,9 +180,9 @@ module axibram_write #( ...@@ -199,9 +180,9 @@ module axibram_write #(
`endif `endif
fifo_same_clock #( .DATA_WIDTH(20+ADDRESS_BITS),.DATA_DEPTH(4)) fifo_same_clock #( .DATA_WIDTH(20+ADDRESS_BITS),.DATA_DEPTH(4))
waddr_i ( waddr_i (
.rst (rst), .rst (1'b0), //rst),
.clk (aclk), .clk (aclk),
.sync_rst (1'b0), .sync_rst (arst),
.we (awvalid && awready), .we (awvalid && awready),
.re (start_write_burst_w), .re (start_write_burst_w),
.data_in ({awid[11:0], awburst[1:0],awsize[1:0],awlen[3:0],awaddr[ADDRESS_BITS+1:2]}), .data_in ({awid[11:0], awburst[1:0],awsize[1:0],awlen[3:0],awaddr[ADDRESS_BITS+1:2]}),
...@@ -219,9 +200,9 @@ fifo_same_clock #( .DATA_WIDTH(20+ADDRESS_BITS),.DATA_DEPTH(4)) ...@@ -219,9 +200,9 @@ fifo_same_clock #( .DATA_WIDTH(20+ADDRESS_BITS),.DATA_DEPTH(4))
); );
fifo_same_clock #( .DATA_WIDTH(49),.DATA_DEPTH(4)) fifo_same_clock #( .DATA_WIDTH(49),.DATA_DEPTH(4))
wdata_i ( wdata_i (
.rst(rst), .rst(1'b0), //rst),
.clk(aclk), .clk(aclk),
.sync_rst (1'b0), .sync_rst (arst),
.we(wvalid && wready), .we(wvalid && wready),
.re(bram_we_w), //start_write_burst_w), // wrong .re(bram_we_w), //start_write_burst_w), // wrong
.data_in({wid[11:0],wlast,wstb[3:0],wdata[31:0]}), .data_in({wid[11:0],wlast,wstb[3:0],wdata[31:0]}),
...@@ -241,16 +222,16 @@ fifo_same_clock #( .DATA_WIDTH(49),.DATA_DEPTH(4)) ...@@ -241,16 +222,16 @@ fifo_same_clock #( .DATA_WIDTH(49),.DATA_DEPTH(4))
reg was_bresp_re=0; reg was_bresp_re=0;
wire bresp_re; wire bresp_re;
assign bresp_re=bready && bvalid && !was_bresp_re; assign bresp_re=bready && bvalid && !was_bresp_re;
always @ (posedge rst or posedge aclk) begin always @ (posedge aclk) begin
if (rst) was_bresp_re<=0; if (arst) was_bresp_re<=0;
else was_bresp_re <= bresp_re; else was_bresp_re <= bresp_re;
end end
fifo_same_clock #( .DATA_WIDTH(14),.DATA_DEPTH(4)) fifo_same_clock #( .DATA_WIDTH(14),.DATA_DEPTH(4))
wresp_i ( wresp_i (
.rst(rst), .rst(1'b0), //rst),
.clk(aclk), .clk(aclk),
.sync_rst (1'b0), .sync_rst (arst),
.we(bram_we_w &&((write_left[3:0]==4'b0) || wlast_out)), // added ((write_left[3:0]==4'b0) || wlast_out) - only last wrtite -> bresp .we(bram_we_w &&((write_left[3:0]==4'b0) || wlast_out)), // added ((write_left[3:0]==4'b0) || wlast_out) - only last wrtite -> bresp
// .re(bready && bvalid), // .re(bready && bvalid),
.re(bresp_re), // not allowing RE next cycle after bvalid .re(bresp_re), // not allowing RE next cycle after bvalid
......
...@@ -34,9 +34,11 @@ module cmprs_afi_mux#( ...@@ -34,9 +34,11 @@ module cmprs_afi_mux#(
parameter CMPRS_AFIMUX_CYCBITS = 3, parameter CMPRS_AFIMUX_CYCBITS = 3,
parameter AFI_MUX_BUF_LATENCY = 2 // buffers read latency from fifo_ren* to fifo_rdata* valid : 2 if no register layers are used parameter AFI_MUX_BUF_LATENCY = 2 // buffers read latency from fifo_ren* to fifo_rdata* valid : 2 if no register layers are used
)( )(
input rst, // input rst,
input mclk, // for command/status input mclk, // for command/status
input hclk, // global clock to run axi_hp @ 150MHz, shared by all compressor channels input hclk, // global clock to run axi_hp @ 150MHz, shared by all compressor channels
input mrst, // @posedge mclk, sync reset
input hrst, // @posedge xclk, sync reset
// programming interface // programming interface
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
input cmd_stb, // strobe (with first byte) for the command a/d input cmd_stb, // strobe (with first byte) for the command a/d
...@@ -386,8 +388,9 @@ module cmprs_afi_mux#( ...@@ -386,8 +388,9 @@ module cmprs_afi_mux#(
.ADDR_WIDTH (4), .ADDR_WIDTH (4),
.DATA_WIDTH (32) .DATA_WIDTH (32)
) cmd_deser_32bit_i ( ) cmd_deser_32bit_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[3:0] .addr (cmd_a), // output[3:0]
...@@ -436,9 +439,11 @@ module cmprs_afi_mux#( ...@@ -436,9 +439,11 @@ module cmprs_afi_mux#(
.CMPRS_AFIMUX_WIDTH(CMPRS_AFIMUX_WIDTH), .CMPRS_AFIMUX_WIDTH(CMPRS_AFIMUX_WIDTH),
.CMPRS_AFIMUX_CYCBITS(CMPRS_AFIMUX_CYCBITS) .CMPRS_AFIMUX_CYCBITS(CMPRS_AFIMUX_CYCBITS)
) cmprs_afi_mux_status_i ( ) cmprs_afi_mux_status_i (
.rst (rst), // input // .rst (rst), // input
.hclk (hclk), // input .hclk (hclk), // input
.mclk (mclk), // input .mclk (mclk), // input
.mrst (mrst), // input
.hrst (hrst), // input
.cmd_data (cmd_data[15:0]), // input[15:0] .cmd_data (cmd_data[15:0]), // input[15:0]
.cmd_a (cmd_a[1:0]), // input[1:0] .cmd_a (cmd_a[1:0]), // input[1:0]
.status_we (cmd_we_status_w), // input .status_we (cmd_we_status_w), // input
......
...@@ -29,9 +29,11 @@ module cmprs_afi_mux_status #( ...@@ -29,9 +29,11 @@ module cmprs_afi_mux_status #(
parameter CMPRS_AFIMUX_WIDTH = 26, // maximal for status: currently only works with 26) parameter CMPRS_AFIMUX_WIDTH = 26, // maximal for status: currently only works with 26)
parameter CMPRS_AFIMUX_CYCBITS = 3 parameter CMPRS_AFIMUX_CYCBITS = 3
) ( ) (
input rst, // input rst,
input hclk, // global clock to run axi_hp @ 150MHz, shared by all compressor channels input hclk, // global clock to run axi_hp @ 150MHz, shared by all compressor channels
input mclk, // for command/status input mclk, // for command/status
input mrst, // @posedge mclk, sync reset
input hrst, // @posedge xclk, sync reset
// mclk domain // mclk domain
input [15:0] cmd_data, // input [15:0] cmd_data, //
input [ 1:0] cmd_a, // input [ 1:0] cmd_a, //
...@@ -100,11 +102,12 @@ module cmprs_afi_mux_status #( ...@@ -100,11 +102,12 @@ module cmprs_afi_mux_status #(
end end
pulse_cross_clock mode_we_hclk_i (.rst(rst), .src_clk(mclk), .dst_clk(hclk), .in_pulse(mode_we), .out_pulse(mode_we_hclk),.busy()); pulse_cross_clock mode_we_hclk_i (.rst(mrst), .src_clk(mclk), .dst_clk(hclk), .in_pulse(mode_we), .out_pulse(mode_we_hclk),.busy());
pulse_cross_clock stb_mclk_i (.rst(rst), .src_clk(hclk), .dst_clk(mclk), .in_pulse(stb_r), .out_pulse(stb_mclk), .busy()); pulse_cross_clock stb_mclk_i (.rst(hrst), .src_clk(hclk), .dst_clk(mclk), .in_pulse(stb_r), .out_pulse(stb_mclk), .busy());
status_router4 status_router4_i ( status_router4 status_router4_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.db_in0 (ad[0 * 8 +: 8]), // input[7:0] .db_in0 (ad[0 * 8 +: 8]), // input[7:0]
.rq_in0 (rq[0]), // input .rq_in0 (rq[0]), // input
.start_in0 (start[0]), // output .start_in0 (start[0]), // output
...@@ -127,8 +130,9 @@ module cmprs_afi_mux_status #( ...@@ -127,8 +130,9 @@ module cmprs_afi_mux_status #(
.STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0), .STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0),
.PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH) .PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH)
) status_generate0_i ( ) status_generate0_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (status_we && (cmd_a==0)), // input .we (status_we && (cmd_a==0)), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_data[0 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0] .status (status_data[0 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0]
...@@ -141,8 +145,9 @@ module cmprs_afi_mux_status #( ...@@ -141,8 +145,9 @@ module cmprs_afi_mux_status #(
.STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0), .STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0),
.PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH) .PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH)
) status_generate1_i ( ) status_generate1_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (status_we && (cmd_a==1)), // input .we (status_we && (cmd_a==1)), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_data[1 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0] .status (status_data[1 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0]
...@@ -155,8 +160,9 @@ module cmprs_afi_mux_status #( ...@@ -155,8 +160,9 @@ module cmprs_afi_mux_status #(
.STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0), .STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0),
.PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH) .PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH)
) status_generate2_i ( ) status_generate2_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (status_we && (cmd_a==2)), // input .we (status_we && (cmd_a==2)), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_data[2 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0] .status (status_data[2 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0]
...@@ -169,8 +175,9 @@ module cmprs_afi_mux_status #( ...@@ -169,8 +175,9 @@ module cmprs_afi_mux_status #(
.STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0), .STATUS_REG_ADDR (CMPRS_AFIMUX_STATUS_REG_ADDR+0),
.PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH) .PAYLOAD_BITS (CMPRS_AFIMUX_WIDTH)
) status_generate3_i ( ) status_generate3_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (status_we && (cmd_a==3)), // input .we (status_we && (cmd_a==3)), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_data[3 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0] .status (status_data[3 * CMPRS_AFIMUX_WIDTH +: CMPRS_AFIMUX_WIDTH]), // input[25:0]
......
...@@ -37,9 +37,12 @@ module histogram_saxi#( ...@@ -37,9 +37,12 @@ module histogram_saxi#(
// parameter HIST_SAXI_STATUS_REG = 'h34, // parameter HIST_SAXI_STATUS_REG = 'h34,
parameter NUM_FRAME_BITS = 4 // number of bits use for frame number parameter NUM_FRAME_BITS = 4 // number of bits use for frame number
)( )(
input rst, // input rst,
input mclk, // for command/status input mclk, // for command/status
input aclk, // global clock to run s_axi (@150MHz?) input aclk, // global clock to run s_axi (@150MHz?)
input mrst, // @posedge mclk, sync reset
input arst, // @posedge aclk, sync reset
// sensor 0, data valid @posedge mclk // sensor 0, data valid @posedge mclk
input [NUM_FRAME_BITS-1:0] frame0, // frame number for which the histogram is provided input [NUM_FRAME_BITS-1:0] frame0, // frame number for which the histogram is provided
input hist_request0, // request to transfer a burst input hist_request0, // request to transfer a burst
...@@ -248,8 +251,8 @@ module histogram_saxi#( ...@@ -248,8 +251,8 @@ module histogram_saxi#(
assign page_sent_aclk = block_run[1] && !block_run[0]; assign page_sent_aclk = block_run[1] && !block_run[0];
// command interface // command interface
always @(posedge rst or posedge mclk) begin always @(posedge mclk) begin
if (rst) mode <= 0; if (mrst) mode <= 0;
else if (we_mode) mode <= cmd_data[HIST_SAXI_MODE_WIDTH-1:0]; else if (we_mode) mode <= cmd_data[HIST_SAXI_MODE_WIDTH-1:0];
end end
always @(posedge mclk) begin always @(posedge mclk) begin
...@@ -357,7 +360,7 @@ module histogram_saxi#( ...@@ -357,7 +360,7 @@ module histogram_saxi#(
pulse_cross_clock pulse_cross_clock_page_sent_i ( pulse_cross_clock pulse_cross_clock_page_sent_i (
.rst (rst), // input .rst (arst), // input
.src_clk (aclk), // input .src_clk (aclk), // input
.dst_clk (mclk), // input .dst_clk (mclk), // input
.in_pulse (page_sent_aclk), // input .in_pulse (page_sent_aclk), // input
...@@ -365,7 +368,7 @@ module histogram_saxi#( ...@@ -365,7 +368,7 @@ module histogram_saxi#(
.busy() // output .busy() // output
); );
pulse_cross_clock pulse_cross_clock_page_written_aclk_i ( pulse_cross_clock pulse_cross_clock_page_written_aclk_i (
.rst (rst), // input .rst (mrst), // input
.src_clk (mclk), // input .src_clk (mclk), // input
.dst_clk (aclk), // input .dst_clk (aclk), // input
.in_pulse (burst_done_w), // input .in_pulse (burst_done_w), // input
...@@ -384,8 +387,9 @@ module histogram_saxi#( ...@@ -384,8 +387,9 @@ module histogram_saxi#(
.ADDR2 (0), .ADDR2 (0),
.ADDR_MASK2 (0) .ADDR_MASK2 (0)
) cmd_deser_sens_i2c_i ( ) cmd_deser_sens_i2c_i (
.rst (rst), // input .rst (1'b0), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_wa), // output[3:0] .addr (cmd_wa), // output[3:0]
...@@ -415,8 +419,9 @@ module histogram_saxi#( ...@@ -415,8 +419,9 @@ module histogram_saxi#(
.DATA_WIDTH(32), .DATA_WIDTH(32),
.DATA_DEPTH(4) .DATA_DEPTH(4)
) fifo_same_clock_i ( ) fifo_same_clock_i (
.rst (rst), // input .rst (1'b0), // input
.clk (aclk), // input .clk (aclk), // input
.sync_rst (arst), // input
.sync_rst (!en_aclk), // input .sync_rst (!en_aclk), // input
.we (buf_re[2]), // input .we (buf_re[2]), // input
.re (fifo_re), // input .re (fifo_re), // input
......
This diff is collapsed.
...@@ -39,9 +39,11 @@ module mult_saxi_wr #( ...@@ -39,9 +39,11 @@ module mult_saxi_wr #(
parameter MULT_SAXI_ADV_RD = 3 // number of clock cycles before end of write to genearte adv_wr_done parameter MULT_SAXI_ADV_RD = 3 // number of clock cycles before end of write to genearte adv_wr_done
) ( ) (
input rst, // global reset // input rst, // global reset
input mclk, // system clock input mclk, // system clock
input aclk, // global clock to run s_axi (@150MHz?) input aclk, // global clock to run s_axi (@150MHz?)
input mrst, // @mclk sync reset
input arst, // @aclk sync reset
// command interface // command interface
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
input cmd_stb, // strobe (with first byte) for the command a/d input cmd_stb, // strobe (with first byte) for the command a/d
...@@ -161,8 +163,8 @@ module mult_saxi_wr #( ...@@ -161,8 +163,8 @@ module mult_saxi_wr #(
assign en_chn_mclk = mode_reg[3:0]; assign en_chn_mclk = mode_reg[3:0];
assign run_chn_mclk = mode_reg[7:4]; assign run_chn_mclk = mode_reg[7:4];
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) mode_reg <= 0; if (mrst) mode_reg <= 0;
else if (we_ctrl && !cmd_a[0]) mode_reg <= cmd_data[7:0]; else if (we_ctrl && !cmd_a[0]) mode_reg <= cmd_data[7:0];
end end
...@@ -420,9 +422,9 @@ module mult_saxi_wr #( ...@@ -420,9 +422,9 @@ module mult_saxi_wr #(
.DATA_WIDTH(35), .DATA_WIDTH(35),
.DATA_DEPTH(4) .DATA_DEPTH(4)
) fifo_same_clock_i ( ) fifo_same_clock_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (aclk), // input .clk (aclk), // input
.sync_rst (!en_aclk), // input .sync_rst (!en_aclk || arst), // input
.we (buf_re[2]), // input .we (buf_re[2]), // input
.re (fifo_re), // input .re (fifo_re), // input
.data_in ({chn_rd_data,is_last_rd[1],inter_buf_data}), // input[31:0] .data_in ({chn_rd_data,is_last_rd[1],inter_buf_data}), // input[31:0]
...@@ -481,8 +483,9 @@ module mult_saxi_wr #( ...@@ -481,8 +483,9 @@ module mult_saxi_wr #(
.ADDR2 (0), .ADDR2 (0),
.ADDR_MASK2 (0) .ADDR_MASK2 (0)
) cmd_deser_sens_i2c_i ( ) cmd_deser_sens_i2c_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[3:0] .addr (cmd_a), // output[3:0]
...@@ -509,7 +512,7 @@ module mult_saxi_wr #( ...@@ -509,7 +512,7 @@ module mult_saxi_wr #(
if (pntr_we_mclk && (pntr_wa == 2'h3)) status_pntr3 <= pntr_wd; if (pntr_we_mclk && (pntr_wa == 2'h3)) status_pntr3 <= pntr_wd;
end end
pulse_cross_clock status_wr_i (.rst(rst), .src_clk(aclk), .dst_clk(mclk), .in_pulse(pntr_we), .out_pulse(pntr_we_mclk),.busy()); pulse_cross_clock status_wr_i (.rst(arst), .src_clk(aclk), .dst_clk(mclk), .in_pulse(pntr_we), .out_pulse(pntr_we_mclk),.busy());
status_generate #( status_generate #(
.STATUS_REG_ADDR (MULT_SAXI_STATUS_REG+4), // not used .STATUS_REG_ADDR (MULT_SAXI_STATUS_REG+4), // not used
...@@ -518,8 +521,9 @@ module mult_saxi_wr #( ...@@ -518,8 +521,9 @@ module mult_saxi_wr #(
.EXTRA_WORDS (4), .EXTRA_WORDS (4),
.EXTRA_REG_ADDR (MULT_SAXI_STATUS_REG) .EXTRA_REG_ADDR (MULT_SAXI_STATUS_REG)
) status_generate_i ( ) status_generate_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (we_ctrl && cmd_a[0]), // input .we (we_ctrl && cmd_a[0]), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_data), // input[128:0] .status (status_data), // input[128:0]
......
...@@ -61,7 +61,8 @@ module cmd_mux #( ...@@ -61,7 +61,8 @@ module cmd_mux #(
) ( ) (
input axi_clk, input axi_clk,
input mclk, input mclk,
input rst, input mrst, // @posedge mclk - sync reset
input arst, // @posedge axi_clk - sync reset
// direct commands from AXI. No wait but for multi-cycle output and command sequencer (having higher priority) // direct commands from AXI. No wait but for multi-cycle output and command sequencer (having higher priority)
input [AXI_WR_ADDR_BITS-1:0] pre_waddr, // AXI write address, before actual writes (to generate busy), valid@start_burst input [AXI_WR_ADDR_BITS-1:0] pre_waddr, // AXI write address, before actual writes (to generate busy), valid@start_burst
input start_wburst, // burst start - should generate ~ready (should be AND-ed with !busy internally) input start_wburst, // burst start - should generate ~ready (should be AND-ed with !busy internally)
...@@ -114,10 +115,10 @@ module cmd_mux #( ...@@ -114,10 +115,10 @@ module cmd_mux #(
assign seq_length_rom_a=par_ad[NUM_CYCLES_LOW_BIT+:5]; assign seq_length_rom_a=par_ad[NUM_CYCLES_LOW_BIT+:5];
assign ss= seq_length[3]; assign ss= seq_length[3];
always @ (posedge axi_clk or posedge rst) begin always @ (posedge axi_clk) begin
if (rst) selected <= 1'b0; if (arst) selected <= 1'b0;
else if (start_wburst) selected <= selected_w; else if (start_wburst) selected <= selected_w;
if (rst) busy_r <= 1'b0; if (arst) busy_r <= 1'b0;
else busy_r <= !fifo_half_empty; else busy_r <= !fifo_half_empty;
end end
...@@ -158,8 +159,8 @@ module cmd_mux #( ...@@ -158,8 +159,8 @@ module cmd_mux #(
5'h1e:seq_length <= NUM_CYCLES_30; 5'h1e:seq_length <= NUM_CYCLES_30;
5'h1f:seq_length <= NUM_CYCLES_31; 5'h1f:seq_length <= NUM_CYCLES_31;
endcase endcase
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) seq_busy_r<=0; if (mrst) seq_busy_r<=0;
else begin else begin
if (ad_stb) begin if (ad_stb) begin
case (seq_length) case (seq_length)
...@@ -177,8 +178,8 @@ module cmd_mux #( ...@@ -177,8 +178,8 @@ module cmd_mux #(
assign can_start_w= ad_stb_r? ss: !seq_busy_r[1]; assign can_start_w= ad_stb_r? ss: !seq_busy_r[1];
assign start_axi_w= can_start_w && ~cmdseq_full_r && fifo_nempty; assign start_axi_w= can_start_w && ~cmdseq_full_r && fifo_nempty;
assign start_w= can_start_w && (cmdseq_full_r || fifo_nempty); assign start_w= can_start_w && (cmdseq_full_r || fifo_nempty);
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) ad_stb_r <= 0; if (mrst) ad_stb_r <= 0;
else ad_stb_r <= start_w; else ad_stb_r <= start_w;
end end
always @ (posedge mclk) begin always @ (posedge mclk) begin
...@@ -188,8 +189,8 @@ module cmd_mux #( ...@@ -188,8 +189,8 @@ module cmd_mux #(
assign cseq_ackn= cseq_wr_en && (!cmdseq_full_r || can_start_w); // cmddseq_full has priority over axi, so (can_start_w && cmdseq_full_r) assign cseq_ackn= cseq_wr_en && (!cmdseq_full_r || can_start_w); // cmddseq_full has priority over axi, so (can_start_w && cmdseq_full_r)
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) cmdseq_full_r <= 0; if (mrst) cmdseq_full_r <= 0;
else cmdseq_full_r <= cseq_ackn || (cmdseq_full_r && !can_start_w); else cmdseq_full_r <= cseq_ackn || (cmdseq_full_r && !can_start_w);
end end
always @ (posedge mclk) begin always @ (posedge mclk) begin
...@@ -204,7 +205,9 @@ module cmd_mux #( ...@@ -204,7 +205,9 @@ module cmd_mux #(
.DATA_WIDTH (AXI_WR_ADDR_BITS+32), .DATA_WIDTH (AXI_WR_ADDR_BITS+32),
.DATA_DEPTH (4) .DATA_DEPTH (4)
) fifo_cross_clocks_i ( ) fifo_cross_clocks_i (
.rst (rst), // input .rst (1'b0), // input
.rrst (mrst), // input
.wrst (arst), // input
.rclk (mclk), // input .rclk (mclk), // input
.wclk (axi_clk), // input .wclk (axi_clk), // input
.we (wr_en && selected), // input .we (wr_en && selected), // input
......
...@@ -30,7 +30,8 @@ module cmd_readback#( ...@@ -30,7 +30,8 @@ module cmd_readback#(
parameter CONTROL_RBACK_ADDR = 'h0000, // AXI write address of control write registers parameter CONTROL_RBACK_ADDR = 'h0000, // AXI write address of control write registers
parameter CONTROL_RBACK_ADDR_MASK = 'h3800 // AXI write address of control registers parameter CONTROL_RBACK_ADDR_MASK = 'h3800 // AXI write address of control registers
)( )(
input rst, input mrst, // @posedge mclk - sync reset
input arst, // @posedge axi_clk - sync reset
input mclk, input mclk,
input axi_clk, input axi_clk,
input [AXI_WR_ADDR_BITS-1:0] par_waddr, // parallel address input [AXI_WR_ADDR_BITS-1:0] par_waddr, // parallel address
...@@ -71,11 +72,11 @@ module cmd_readback#( ...@@ -71,11 +72,11 @@ module cmd_readback#(
assign axird_selected = select_r; assign axird_selected = select_r;
always @ (posedge rst or posedge axi_clk) begin always @ (posedge axi_clk) begin
if (rst) axird_regen <= 0; if (arst) axird_regen <= 0;
else axird_regen <= axird_ren; else axird_regen <= axird_ren;
if (rst) select_r <= 0; if (arst) select_r <= 0;
else if (axird_start_burst) select_r <= select_w; else if (axird_start_burst) select_r <= select_w;
end end
...@@ -85,8 +86,8 @@ module cmd_readback#( ...@@ -85,8 +86,8 @@ module cmd_readback#(
select_d <= select_r; select_d <= select_r;
end end
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) we <= 0; if (mrst) we <= 0;
else we <= we_w; else we <= we_w;
end end
always @ (posedge mclk) begin always @ (posedge mclk) begin
......
...@@ -132,16 +132,16 @@ module cmprs_cmd_decode#( ...@@ -132,16 +132,16 @@ module cmprs_cmd_decode#(
parameter CMPRS_CSAT_CB_BITS = 10, // number of bits in blue scale field in color saturation word parameter CMPRS_CSAT_CB_BITS = 10, // number of bits in blue scale field in color saturation word
parameter CMPRS_CSAT_CR = 12, // bit # of number of red scale field in color saturation word parameter CMPRS_CSAT_CR = 12, // bit # of number of red scale field in color saturation word
parameter CMPRS_CSAT_CR_BITS = 10, // number of bits in red scale field in color saturation word parameter CMPRS_CSAT_CR_BITS = 10, // number of bits in red scale field in color saturation word
parameter CMPRS_CORING_BITS = 3, // number of bits in coring mode parameter CMPRS_CORING_BITS = 3 // number of bits in coring mode
parameter CMPRS_STUFFER_NEG = 1 // stuffer runs @ negedge xclk2x //parameter CMPRS_STUFFER_NEG = 1 // stuffer runs @ negedge xclk2x
)( )(
input rst, // input rst,
input xclk, // global clock input, compressor single clock rate input xclk, // global clock input, compressor single clock rate
// input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned
input mclk, // global system/memory clock input mclk, // global system/memory clock
input mrst, // @posedge mclk, sync reset
input ctrl_we, // input - @mclk control register write enable input ctrl_we, // input - @mclk control register write enable
input format_we, // input - @mclk write number of tiles and left margin input format_we, // input - @mclk write number of tiles and left margin
input color_sat_we, // input - @mclk write color saturation values input color_sat_we, // input - @mclk write color saturation values
...@@ -236,57 +236,57 @@ module cmprs_cmd_decode#( ...@@ -236,57 +236,57 @@ module cmprs_cmd_decode#(
wire frame_start_xclk; wire frame_start_xclk;
assign cmprs_en_mclk = cmprs_en_mclk_r; assign cmprs_en_mclk = cmprs_en_mclk_r;
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) ctrl_we_r <= 0; if (mrst) ctrl_we_r <= 0;
else ctrl_we_r <= ctrl_we; else ctrl_we_r <= ctrl_we;
if (rst) format_we_r <= 0; if (mrst) format_we_r <= 0;
else format_we_r <= format_we; else format_we_r <= format_we;
if (rst) color_sat_we_r <= 0; if (mrst) color_sat_we_r <= 0;
else color_sat_we_r <= color_sat_we; else color_sat_we_r <= color_sat_we;
if (rst) coring_we_r <= 0; if (mrst) coring_we_r <= 0;
else coring_we_r <= coring_we; else coring_we_r <= coring_we;
if (rst) di_r <= 0; if (mrst) di_r <= 0;
else if (ctrl_we || format_we || color_sat_we || coring_we) di_r <= di[30:0]; else if (ctrl_we || format_we || color_sat_we || coring_we) di_r <= di[30:0];
if (rst) cmprs_en_mclk_r <= 0; if (mrst) cmprs_en_mclk_r <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_RUN]) cmprs_en_mclk_r <= (di_r[CMPRS_CBIT_RUN-1 -:CMPRS_CBIT_RUN_BITS] != CMPRS_CBIT_RUN_RST); else if (ctrl_we_r && di_r[CMPRS_CBIT_RUN]) cmprs_en_mclk_r <= (di_r[CMPRS_CBIT_RUN-1 -:CMPRS_CBIT_RUN_BITS] != CMPRS_CBIT_RUN_RST);
if (rst) cmprs_run_mclk <= 0; if (mrst) cmprs_run_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_RUN]) cmprs_run_mclk <= (di_r[CMPRS_CBIT_RUN-1 -:CMPRS_CBIT_RUN_BITS] == CMPRS_CBIT_RUN_ENABLE); else if (ctrl_we_r && di_r[CMPRS_CBIT_RUN]) cmprs_run_mclk <= (di_r[CMPRS_CBIT_RUN-1 -:CMPRS_CBIT_RUN_BITS] == CMPRS_CBIT_RUN_ENABLE);
if (rst) cmprs_standalone <= 0; if (mrst) cmprs_standalone <= 0;
else if (ctrl_we_r) cmprs_standalone <= ctrl_we_r && di_r[CMPRS_CBIT_RUN] && (di_r[CMPRS_CBIT_RUN-1 -:CMPRS_CBIT_RUN_BITS] == CMPRS_CBIT_RUN_STANDALONE); else if (ctrl_we_r) cmprs_standalone <= ctrl_we_r && di_r[CMPRS_CBIT_RUN] && (di_r[CMPRS_CBIT_RUN-1 -:CMPRS_CBIT_RUN_BITS] == CMPRS_CBIT_RUN_STANDALONE);
if (rst) sigle_frame_buf <= 0; if (mrst) sigle_frame_buf <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_FRAMES]) sigle_frame_buf <= (di_r[CMPRS_CBIT_FRAMES-1 -:CMPRS_CBIT_FRAMES_BITS] == CMPRS_CBIT_FRAMES_SINGLE); else if (ctrl_we_r && di_r[CMPRS_CBIT_FRAMES]) sigle_frame_buf <= (di_r[CMPRS_CBIT_FRAMES-1 -:CMPRS_CBIT_FRAMES_BITS] == CMPRS_CBIT_FRAMES_SINGLE);
if (rst) cmprs_qpage_mclk <= 0; if (mrst) cmprs_qpage_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_QBANK]) cmprs_qpage_mclk <= di_r[CMPRS_CBIT_QBANK-1 -:CMPRS_CBIT_QBANK_BITS]; else if (ctrl_we_r && di_r[CMPRS_CBIT_QBANK]) cmprs_qpage_mclk <= di_r[CMPRS_CBIT_QBANK-1 -:CMPRS_CBIT_QBANK_BITS];
if (rst) cmprs_dcsub_mclk <= 0; if (mrst) cmprs_dcsub_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_DCSUB]) cmprs_dcsub_mclk <= di_r[CMPRS_CBIT_DCSUB-1 -:CMPRS_CBIT_DCSUB_BITS]; else if (ctrl_we_r && di_r[CMPRS_CBIT_DCSUB]) cmprs_dcsub_mclk <= di_r[CMPRS_CBIT_DCSUB-1 -:CMPRS_CBIT_DCSUB_BITS];
if (rst) cmprs_mode_mclk <= 0; if (mrst) cmprs_mode_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_CMODE]) cmprs_mode_mclk <= di_r[CMPRS_CBIT_CMODE-1 -:CMPRS_CBIT_CMODE_BITS]; else if (ctrl_we_r && di_r[CMPRS_CBIT_CMODE]) cmprs_mode_mclk <= di_r[CMPRS_CBIT_CMODE-1 -:CMPRS_CBIT_CMODE_BITS];
if (rst) cmprs_fmode_mclk <= 0; if (mrst) cmprs_fmode_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_FOCUS]) cmprs_fmode_mclk <= di_r[CMPRS_CBIT_FOCUS-1 -:CMPRS_CBIT_FOCUS_BITS]; else if (ctrl_we_r && di_r[CMPRS_CBIT_FOCUS]) cmprs_fmode_mclk <= di_r[CMPRS_CBIT_FOCUS-1 -:CMPRS_CBIT_FOCUS_BITS];
if (rst) bayer_shift_mclk <= 0; if (mrst) bayer_shift_mclk <= 0;
else if (ctrl_we_r && di_r[CMPRS_CBIT_BAYER]) bayer_shift_mclk <= di_r[CMPRS_CBIT_BAYER-1 -:CMPRS_CBIT_BAYER_BITS]; else if (ctrl_we_r && di_r[CMPRS_CBIT_BAYER]) bayer_shift_mclk <= di_r[CMPRS_CBIT_BAYER-1 -:CMPRS_CBIT_BAYER_BITS];
if (rst) format_mclk <= 0; if (mrst) format_mclk <= 0;
else if (format_we_r) format_mclk <= di_r[30:0]; else if (format_we_r) format_mclk <= di_r[30:0];
if (rst) color_sat_mclk <= 0; if (mrst) color_sat_mclk <= 0;
else if (color_sat_we_r) color_sat_mclk <= di_r[23:0]; else if (color_sat_we_r) color_sat_mclk <= di_r[23:0];
if (rst) coring_mclk <= 0; if (mrst) coring_mclk <= 0;
else if (coring_we_r) coring_mclk <= di_r[2:0]; else if (coring_we_r) coring_mclk <= di_r[2:0];
end end
...@@ -438,11 +438,11 @@ module cmprs_cmd_decode#( ...@@ -438,11 +438,11 @@ module cmprs_cmd_decode#(
end end
//frame_start_xclk //frame_start_xclk
pulse_cross_clock ctrl_we_xclk_i (.rst(rst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(ctrl_we_r), .out_pulse(ctrl_we_xclk),.busy()); pulse_cross_clock ctrl_we_xclk_i (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(ctrl_we_r), .out_pulse(ctrl_we_xclk),.busy());
pulse_cross_clock format_we_xclk_i (.rst(rst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(format_we_r), .out_pulse(format_we_xclk),.busy()); pulse_cross_clock format_we_xclk_i (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(format_we_r), .out_pulse(format_we_xclk),.busy());
pulse_cross_clock color_sat_we_xclk_i (.rst(rst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(color_sat_we_r), .out_pulse(color_sat_we_xclk),.busy()); pulse_cross_clock color_sat_we_xclk_i (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(color_sat_we_r), .out_pulse(color_sat_we_xclk),.busy());
pulse_cross_clock coring__we_xclk_i (.rst(rst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(coring_we_r), .out_pulse(coring_we_xclk),.busy()); pulse_cross_clock coring__we_xclk_i (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(coring_we_r), .out_pulse(coring_we_xclk),.busy());
pulse_cross_clock frame_start_xclk_i (.rst(rst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(frame_start), .out_pulse(frame_start_xclk),.busy()); pulse_cross_clock frame_start_xclk_i (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(frame_start), .out_pulse(frame_start_xclk),.busy());
endmodule endmodule
...@@ -27,10 +27,12 @@ module cmprs_frame_sync#( ...@@ -27,10 +27,12 @@ module cmprs_frame_sync#(
parameter CMPRS_TIMEOUT= 1000 // mclk cycles parameter CMPRS_TIMEOUT= 1000 // mclk cycles
)( )(
input rst, // input rst,
input xclk, // global clock input, compressor single clock rate input xclk, // global clock input, compressor single clock rate
// input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned
input mclk, // global system/memory clock input mclk, // global system/memory clock
input mrst, // @posedge mclk, sync reset
input xrst, // @posedge xclk, sync reset
input cmprs_en, // @mclk 0 resets immediately input cmprs_en, // @mclk 0 resets immediately
output cmprs_en_extend, // @mclk keep compressor enabled for graceful shutdown output cmprs_en_extend, // @mclk keep compressor enabled for graceful shutdown
...@@ -90,8 +92,8 @@ module cmprs_frame_sync#( ...@@ -90,8 +92,8 @@ module cmprs_frame_sync#(
assign stuffer_running_mclk = stuffer_running_mclk_r; assign stuffer_running_mclk = stuffer_running_mclk_r;
assign reading_frame = reading_frame_r; assign reading_frame = reading_frame_r;
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) cmprs_en_extend_r <= 0; if (mrst) cmprs_en_extend_r <= 0;
else if (cmprs_en) cmprs_en_extend_r <= 1; else if (cmprs_en) cmprs_en_extend_r <= 1;
else if ((timeout == 0) || !stuffer_running_mclk_r) cmprs_en_extend_r <= 0; else if ((timeout == 0) || !stuffer_running_mclk_r) cmprs_en_extend_r <= 0;
end end
...@@ -132,8 +134,8 @@ module cmprs_frame_sync#( ...@@ -132,8 +134,8 @@ module cmprs_frame_sync#(
end end
pulse_cross_clock vsync_late_mclk_i (.rst(rst), .src_clk(xclk), .dst_clk(mclk), .in_pulse(vsync_late), .out_pulse(vsync_late_mclk),.busy()); pulse_cross_clock vsync_late_mclk_i (.rst(xrst), .src_clk(xclk), .dst_clk(mclk), .in_pulse(vsync_late), .out_pulse(vsync_late_mclk),.busy());
pulse_cross_clock frame_started_i (.rst(rst), .src_clk(xclk), .dst_clk(mclk), .in_pulse(frame_started), .out_pulse(frame_started_mclk),.busy()); pulse_cross_clock frame_started_i (.rst(xrst), .src_clk(xclk), .dst_clk(mclk), .in_pulse(frame_started), .out_pulse(frame_started_mclk),.busy());
endmodule endmodule
...@@ -25,10 +25,13 @@ ...@@ -25,10 +25,13 @@
module cmprs_macroblock_buf_iface #( module cmprs_macroblock_buf_iface #(
)( )(
input rst, // input rst,
input xclk, // global clock input, compressor single clock rate input xclk, // global clock input, compressor single clock rate
input mclk, // global clock for commands (posedge) and write side of the memory buffer (negedge) input mclk, // global clock for commands (posedge) and write side of the memory buffer (negedge)
input mrst, // @posedge mclk, sync reset
input xrst, // @posedge xclk, sync reset
// buffer interface, DDR3 memory read // buffer interface, DDR3 memory read
input xfer_reset_page_rd, // @ negedge mclk - reset ddr3 memory buffer. Use it to reset the read buffer too input xfer_reset_page_rd, // @ negedge mclk - reset ddr3 memory buffer. Use it to reset the read buffer too
input page_ready_chn, // single mclk (posedge) input page_ready_chn, // single mclk (posedge)
...@@ -200,18 +203,19 @@ module cmprs_macroblock_buf_iface #( ...@@ -200,18 +203,19 @@ module cmprs_macroblock_buf_iface #(
end end
reg nmrst;
always @(negedge mclk) nmrst <= mrst;
// synchronization between mclk and xclk clock domains // synchronization between mclk and xclk clock domains
// negedge mclk -> xclk (verify clock inversion is absorbed) // negedge mclk -> xclk (verify clock inversion is absorbed)
pulse_cross_clock reset_page_rd_i (.rst(rst), .src_clk(~mclk),.dst_clk(xclk), .in_pulse(xfer_reset_page_rd), .out_pulse(reset_page_rd),.busy()); pulse_cross_clock reset_page_rd_i (.rst(nmrst), .src_clk(~mclk),.dst_clk(xclk), .in_pulse(xfer_reset_page_rd), .out_pulse(reset_page_rd),.busy());
// mclk -> xclk // mclk -> xclk
pulse_cross_clock page_ready_i (.rst(rst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(page_ready_chn), .out_pulse(page_ready),.busy()); pulse_cross_clock page_ready_i (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(page_ready_chn), .out_pulse(page_ready),.busy());
multipulse_cross_clock #( multipulse_cross_clock #(
.WIDTH(3), .WIDTH(3),
.EXTRA_DLY(0) .EXTRA_DLY(0)
) multipulse_cross_clock_i ( ) multipulse_cross_clock_i (
.rst (rst), // input .rst (xrst), // input
.src_clk (xclk), // input .src_clk (xclk), // input
.dst_clk (mclk), // input .dst_clk (mclk), // input
.num_pulses ({1'b0,add_invalid}), // input[0:0] .num_pulses ({1'b0,add_invalid}), // input[0:0]
......
...@@ -21,9 +21,11 @@ ...@@ -21,9 +21,11 @@
`timescale 1ns/1ps `timescale 1ns/1ps
module cmprs_out_fifo( module cmprs_out_fifo(
input rst, // mostly for simulation // input rst, // mostly for simulation
// wclk domain // wclk domain
input wclk, // source clock (2x pixel clock, inverted) input wclk, // source clock (2x pixel clock, inverted)
input wrst, // @posedge wclk, sync reset
input we, input we,
input [15:0] wdata, input [15:0] wdata,
input wa_rst, // reset low address bits when stuffer is disabled (to make sure it is multiple of 32 bytes input wa_rst, // reset low address bits when stuffer is disabled (to make sure it is multiple of 32 bytes
...@@ -32,6 +34,7 @@ module cmprs_out_fifo( ...@@ -32,6 +34,7 @@ module cmprs_out_fifo(
// rclk domain // rclk domain
input rclk, input rclk,
input rrst, // @posedge rclk, sync reset
input rst_fifo, // reset FIFO (set read address to write, reset count) input rst_fifo, // reset FIFO (set read address to write, reset count)
input ren, input ren,
output [63:0] rdata, output [63:0] rdata,
...@@ -54,8 +57,8 @@ module cmprs_out_fifo( ...@@ -54,8 +57,8 @@ module cmprs_out_fifo(
assign fifo_count = count32; assign fifo_count = count32;
assign eof = wlast_rclk; assign eof = wlast_rclk;
always @ (posedge rst or posedge wclk) begin always @ (posedge wclk) begin
if (rst) waddr <= 0; if (wrst) waddr <= 0;
else if (wa_rst) waddr <= waddr & 11'h7f0; // reset 4 LSBs only else if (wa_rst) waddr <= waddr & 11'h7f0; // reset 4 LSBs only
else if (we) waddr <= waddr + 1; else if (we) waddr <= waddr + 1;
end end
...@@ -82,10 +85,10 @@ module cmprs_out_fifo( ...@@ -82,10 +85,10 @@ module cmprs_out_fifo(
end end
// wclk -> rclk // wclk -> rclk
pulse_cross_clock written32b_i (.rst(rst), .src_clk(wclk), .dst_clk(rclk), .in_pulse(we && (&waddr[3:0])), .out_pulse(written32b),.busy()); pulse_cross_clock written32b_i (.rst(wrst), .src_clk(wclk), .dst_clk(rclk), .in_pulse(we && (&waddr[3:0])), .out_pulse(written32b),.busy());
pulse_cross_clock wlast_rclk_i (.rst(rst), .src_clk(wclk), .dst_clk(rclk), .in_pulse(wlast), .out_pulse(wlast_rclk),.busy()); pulse_cross_clock wlast_rclk_i (.rst(wrst), .src_clk(wclk), .dst_clk(rclk), .in_pulse(wlast), .out_pulse(wlast_rclk),.busy());
// rclk -> wclk // rclk -> wclk
pulse_cross_clock eof_written_wclk_i (.rst(rst), .src_clk(rclk), .dst_clk(wclk), .in_pulse(eof_written), .out_pulse(eof_written_wclk),.busy()); pulse_cross_clock eof_written_wclk_i (.rst(rrst), .src_clk(rclk), .dst_clk(wclk), .in_pulse(eof_written), .out_pulse(eof_written_wclk),.busy());
ram_var_w_var_r #( ram_var_w_var_r #(
.REGISTERS(1), .REGISTERS(1),
.LOG2WIDTH_WR(4), .LOG2WIDTH_WR(4),
......
...@@ -113,9 +113,13 @@ module compressor393 # ( ...@@ -113,9 +113,13 @@ module compressor393 # (
parameter AFI_MUX_BUF_LATENCY = 2 // buffers read latency from fifo_ren* to fifo_rdata* valid : 2 if no register layers are used parameter AFI_MUX_BUF_LATENCY = 2 // buffers read latency from fifo_ren* to fifo_rdata* valid : 2 if no register layers are used
)( )(
input rst, // global reset // input rst, // global reset
input xclk, // global clock input, compressor single clock rate input xclk, // global clock input, compressor single clock rate
input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned
input mrst, // @posedge mclk, sync reset
input xrst, // @posedge xclk, sync reset
input hrst, // @posedge hclk, sync reset
// programming interface // programming interface
input mclk, // global system/memory clock input mclk, // global system/memory clock
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
...@@ -244,8 +248,9 @@ module compressor393 # ( ...@@ -244,8 +248,9 @@ module compressor393 # (
/* Instance template for module status_router8 */ /* Instance template for module status_router8 */
status_router8 status_router8_i ( status_router8 status_router8_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.db_in0 (status_ad_mux[ 0 +: 8]), // input[7:0] .db_in0 (status_ad_mux[ 0 +: 8]), // input[7:0]
.rq_in0 (status_rq_mux[0]), // input .rq_in0 (status_rq_mux[0]), // input
.start_in0 (status_start_mux[0]), // output .start_in0 (status_start_mux[0]), // output
...@@ -354,9 +359,12 @@ module compressor393 # ( ...@@ -354,9 +359,12 @@ module compressor393 # (
.CMPRS_TIMEOUT_BITS (CMPRS_TIMEOUT_BITS), .CMPRS_TIMEOUT_BITS (CMPRS_TIMEOUT_BITS),
.CMPRS_TIMEOUT (CMPRS_TIMEOUT) .CMPRS_TIMEOUT (CMPRS_TIMEOUT)
) jp_channel_i ( ) jp_channel_i (
.rst (rst), // input // .rst (rst), // input
.xclk (xclk), // input .xclk (xclk), // input
.xclk2x (xclk2x), // input .xclk2x (xclk2x), // input
.mrst (mrst), // input
.xrst (xrst), // input
.hrst (hrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_ad), // input[7:0] .cmd_ad (cmd_ad), // input[7:0]
.cmd_stb (cmd_stb), // input .cmd_stb (cmd_stb), // input
...@@ -417,9 +425,11 @@ module compressor393 # ( ...@@ -417,9 +425,11 @@ module compressor393 # (
.CMPRS_AFIMUX_CYCBITS (CMPRS_AFIMUX_CYCBITS), .CMPRS_AFIMUX_CYCBITS (CMPRS_AFIMUX_CYCBITS),
.AFI_MUX_BUF_LATENCY (AFI_MUX_BUF_LATENCY) .AFI_MUX_BUF_LATENCY (AFI_MUX_BUF_LATENCY)
) cmprs_afi0_mux_i ( ) cmprs_afi0_mux_i (
.rst (rst), // input // .rst (rst), // input
.mclk (mclk), // input .mclk (mclk), // input
.hclk (hclk), // input .hclk (hclk), // input
.mrst (mrst), // input
.hrst (hrst), // input
.cmd_ad (cmd_ad), // input[7:0] .cmd_ad (cmd_ad), // input[7:0]
.cmd_stb (cmd_stb), // input .cmd_stb (cmd_stb), // input
.status_ad (status_ad_mux[32 +: 8]), // output[7:0] .status_ad (status_ad_mux[32 +: 8]), // output[7:0]
...@@ -490,9 +500,11 @@ module compressor393 # ( ...@@ -490,9 +500,11 @@ module compressor393 # (
.CMPRS_AFIMUX_CYCBITS (CMPRS_AFIMUX_CYCBITS), .CMPRS_AFIMUX_CYCBITS (CMPRS_AFIMUX_CYCBITS),
.AFI_MUX_BUF_LATENCY (AFI_MUX_BUF_LATENCY) .AFI_MUX_BUF_LATENCY (AFI_MUX_BUF_LATENCY)
) cmprs_afi1_mux_i ( ) cmprs_afi1_mux_i (
.rst (rst), // input // .rst (rst), // input
.mclk (mclk), // input .mclk (mclk), // input
.hclk (hclk), // input .hclk (hclk), // input
.mrst (mrst), // input
.hrst (hrst), // input
.cmd_ad (cmd_ad), // input[7:0] .cmd_ad (cmd_ad), // input[7:0]
.cmd_stb (cmd_stb), // input .cmd_stb (cmd_stb), // input
.status_ad (status_ad_mux[40 +: 8]), // output[7:0] .status_ad (status_ad_mux[40 +: 8]), // output[7:0]
...@@ -561,9 +573,11 @@ module compressor393 # ( ...@@ -561,9 +573,11 @@ module compressor393 # (
.CMPRS_AFIMUX_CYCBITS (CMPRS_AFIMUX_CYCBITS), .CMPRS_AFIMUX_CYCBITS (CMPRS_AFIMUX_CYCBITS),
.AFI_MUX_BUF_LATENCY (AFI_MUX_BUF_LATENCY) .AFI_MUX_BUF_LATENCY (AFI_MUX_BUF_LATENCY)
) cmprs_afi0_mux_i ( ) cmprs_afi0_mux_i (
.rst (rst), // input // .rst (rst), // input
.mclk (mclk), // input .mclk (mclk), // input
.hclk (hclk), // input .hclk (hclk), // input
.mrst (mrst), // input
.hrst (hrst), // input
.cmd_ad (cmd_ad), // input[7:0] .cmd_ad (cmd_ad), // input[7:0]
.cmd_stb (cmd_stb), // input .cmd_stb (cmd_stb), // input
.status_ad (status_ad_mux[32 +: 8]), // output[7:0] .status_ad (status_ad_mux[32 +: 8]), // output[7:0]
......
...@@ -97,9 +97,13 @@ module jp_channel#( ...@@ -97,9 +97,13 @@ module jp_channel#(
)( )(
input rst, // global reset // input rst, // global reset
input xclk, // global clock input, compressor single clock rate input xclk, // global clock input, compressor single clock rate
input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned
input mrst, // @posedge mclk, sync reset
input xrst, // @posedge xclk, sync reset
input hrst, // @posedge xclk, sync reset
// programming interface // programming interface
input mclk, // global system/memory clock input mclk, // global system/memory clock
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
...@@ -332,8 +336,9 @@ module jp_channel#( ...@@ -332,8 +336,9 @@ module jp_channel#(
.ADDR_WIDTH (3), .ADDR_WIDTH (3),
.DATA_WIDTH (32) .DATA_WIDTH (32)
) cmd_deser_32bit_i ( ) cmd_deser_32bit_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[3:0] .addr (cmd_a), // output[3:0]
...@@ -356,8 +361,9 @@ module jp_channel#( ...@@ -356,8 +361,9 @@ module jp_channel#(
.EXTRA_REG_ADDR (CMPRS_HIFREQ_REG_ADDR) .EXTRA_REG_ADDR (CMPRS_HIFREQ_REG_ADDR)
) status_generate_i ( ) status_generate_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // 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 ({hifreq,status_data}), // input[2:0] .status ({hifreq,status_data}), // input[2:0]
...@@ -383,6 +389,7 @@ module jp_channel#( ...@@ -383,6 +389,7 @@ module jp_channel#(
.we (buf_we), // input .we (buf_we), // input
.data_in (buf_din) // input[63:0] .data_in (buf_din) // input[63:0]
); );
cmprs_cmd_decode #( cmprs_cmd_decode #(
.CMPRS_CBIT_RUN (CMPRS_CBIT_RUN), .CMPRS_CBIT_RUN (CMPRS_CBIT_RUN),
.CMPRS_CBIT_RUN_BITS (CMPRS_CBIT_RUN_BITS), .CMPRS_CBIT_RUN_BITS (CMPRS_CBIT_RUN_BITS),
...@@ -433,9 +440,10 @@ module jp_channel#( ...@@ -433,9 +440,10 @@ module jp_channel#(
.CMPRS_CSAT_CR_BITS (CMPRS_CSAT_CR_BITS), .CMPRS_CSAT_CR_BITS (CMPRS_CSAT_CR_BITS),
.CMPRS_CORING_BITS (CMPRS_CORING_BITS) .CMPRS_CORING_BITS (CMPRS_CORING_BITS)
) cmprs_cmd_decode_i ( ) cmprs_cmd_decode_i (
.rst (rst), // input // .rst (rst), // input
.xclk (xclk), // input - global clock input, compressor single clock rate .xclk (xclk), // input - global clock input, compressor single clock rate
.mclk (mclk), // input - global system/memory clock .mclk (mclk), // input - global system/memory clock
.mrst (mrst), // input
.ctrl_we (set_ctrl_reg_w), // input - control register write enable .ctrl_we (set_ctrl_reg_w), // input - control register write enable
.format_we (set_format_w), // input - write number of tiles and left margin .format_we (set_format_w), // input - write number of tiles and left margin
.color_sat_we (set_color_saturation_w), // input - write color saturation values .color_sat_we (set_color_saturation_w), // input - write color saturation values
...@@ -493,9 +501,11 @@ module jp_channel#( ...@@ -493,9 +501,11 @@ module jp_channel#(
.CMPRS_TIMEOUT_BITS (CMPRS_TIMEOUT_BITS), .CMPRS_TIMEOUT_BITS (CMPRS_TIMEOUT_BITS),
.CMPRS_TIMEOUT (CMPRS_TIMEOUT) .CMPRS_TIMEOUT (CMPRS_TIMEOUT)
) cmprs_frame_sync_i ( ) cmprs_frame_sync_i (
.rst (rst), // input // .rst (rst), // input
.xclk (xclk), // input - global clock input, compressor single clock rate .xclk (xclk), // input - global clock input, compressor single clock rate
.mclk (mclk), // input - global system/memory clock .mclk (mclk), // input - global system/memory clock
.mrst (mrst), // input
.xrst (xrst), // input
.cmprs_en (cmprs_en_mclk), // input - @mclk 0 resets immediately .cmprs_en (cmprs_en_mclk), // input - @mclk 0 resets immediately
.cmprs_en_extend (cmprs_en_extend), // output .cmprs_en_extend (cmprs_en_extend), // output
.cmprs_run (cmprs_run_mclk), // input - @mclk enable propagation of vsync_late to frame_start_dst in bonded(sync to src) mode .cmprs_run (cmprs_run_mclk), // input - @mclk enable propagation of vsync_late to frame_start_dst in bonded(sync to src) mode
...@@ -526,9 +536,11 @@ module jp_channel#( ...@@ -526,9 +536,11 @@ module jp_channel#(
); );
cmprs_macroblock_buf_iface cmprs_macroblock_buf_iface_i ( cmprs_macroblock_buf_iface cmprs_macroblock_buf_iface_i (
.rst (rst), // input // .rst (rst), // input
.xclk (xclk), // input .xclk (xclk), // input
.mclk (mclk), // input .mclk (mclk), // input
.mrst (mrst), // input
.xrst (xrst), // input
.xfer_reset_page_rd (xfer_reset_page_rd), // input .xfer_reset_page_rd (xfer_reset_page_rd), // input
.page_ready_chn (page_ready_chn), // input .page_ready_chn (page_ready_chn), // input
.next_page_chn (next_page_chn), // output .next_page_chn (next_page_chn), // output
...@@ -791,7 +803,10 @@ module jp_channel#( ...@@ -791,7 +803,10 @@ module jp_channel#(
wire eof_written_xclk2xn; wire eof_written_xclk2xn;
// re-sync to posedge xclk2x // re-sync to posedge xclk2x
pulse_cross_clock finish_dcc_i (.rst(rst), .src_clk(~xclk2x), .dst_clk(xclk2x), .in_pulse(stuffer_done), .out_pulse(finish_dcc),.busy()); reg xrst2xn;
always @ (negedge xclk2x) xrst2xn <= xrst;
pulse_cross_clock finish_dcc_i (.rst(xrst2xn), .src_clk(~xclk2x), .dst_clk(xclk2x), .in_pulse(stuffer_done), .out_pulse(finish_dcc),.busy());
dcc_sync393 dcc_sync393_i ( dcc_sync393 dcc_sync393_i (
.sclk (xclk2x), // input .sclk (xclk2x), // input
...@@ -850,8 +865,11 @@ module jp_channel#( ...@@ -850,8 +865,11 @@ module jp_channel#(
stuffer393 stuffer393_i ( stuffer393 stuffer393_i (
.rst (rst), // input // .rst (rst), // input
.mclk (mclk), // input .mclk (mclk), // input
.mrst (mrst), // input
.xrst (xrst), // input
.ts_pre_stb (ts_pre_stb), // input 1 cycle before timestamp data, @mclk .ts_pre_stb (ts_pre_stb), // input 1 cycle before timestamp data, @mclk
.ts_data (ts_data), // input[7:0] 8-byte timestamp data (s0,s1,s2,s3,us0,us1,us2,us3==0) .ts_data (ts_data), // input[7:0] 8-byte timestamp data (s0,s1,s2,s3,us0,us1,us2,us3==0)
.color_first (color_first), // input valid @xclk - only for sec/usec .color_first (color_first), // input valid @xclk - only for sec/usec
...@@ -878,17 +896,20 @@ module jp_channel#( ...@@ -878,17 +896,20 @@ module jp_channel#(
`endif `endif
); );
pulse_cross_clock stuffer_done_mclk_i (.rst(rst), .src_clk(~xclk2x), .dst_clk(mclk), .in_pulse(stuffer_done), .out_pulse(stuffer_done_mclk),.busy()); pulse_cross_clock stuffer_done_mclk_i (.rst(xrst2xn), .src_clk(~xclk2x), .dst_clk(mclk), .in_pulse(stuffer_done), .out_pulse(stuffer_done_mclk),.busy());
cmprs_out_fifo cmprs_out_fifo_i ( cmprs_out_fifo cmprs_out_fifo_i (
.rst (rst), // input mostly for simulation // .rst (rst), // input mostly for simulation
// source (stuffer) clock domain // source (stuffer) clock domain
.wclk (~xclk2x), // input source clock (2x pixel clock, inverted) - same as stuffer out .wclk (~xclk2x), // input source clock (2x pixel clock, inverted) - same as stuffer out
.wrst (xrst2xn), // input mostly for simulation
.we (stuffer_dv), // input write data from stuffer .we (stuffer_dv), // input write data from stuffer
.wdata (stuffer_do), // input[15:0] data from stuffer module; .wdata (stuffer_do), // input[15:0] data from stuffer module;
.wa_rst (!stuffer_en), // input reset low address bits when stuffer is disabled (to make sure it is multiple of 32 bytes .wa_rst (!stuffer_en), // input reset low address bits when stuffer is disabled (to make sure it is multiple of 32 bytes
.wlast (stuffer_done), // input - written last 32 bytes of a frame (flush FIFO) - stuffer_done (has to be later than we) .wlast (stuffer_done), // input - written last 32 bytes of a frame (flush FIFO) - stuffer_done (has to be later than we)
.eof_written_wclk (eof_written_xclk2xn), // output - AFI had transferred frame data to the system memory .eof_written_wclk (eof_written_xclk2xn), // output - AFI had transferred frame data to the system memory
.rclk (hclk), // input - AFI clock .rclk (hclk), // input - AFI clock
.rrst (hrst), // input - AFI clock
// AFI clock domain // AFI clock domain
.rst_fifo (fifo_rst), // input - reset FIFO (set read address to write, reset count) .rst_fifo (fifo_rst), // input - reset FIFO (set read address to write, reset count)
.ren (fifo_ren), // input - fifo read from AFI channel mux .ren (fifo_ren), // input - fifo read from AFI channel mux
...@@ -898,7 +919,7 @@ module jp_channel#( ...@@ -898,7 +919,7 @@ module jp_channel#(
.flush_fifo (fifo_flush), // output level signalling that FIFO has data from the current frame (use short AXI burst if needed) .flush_fifo (fifo_flush), // output level signalling that FIFO has data from the current frame (use short AXI burst if needed)
.fifo_count (fifo_count) // output[7:0] - number of 32-byte chunks available in FIFO .fifo_count (fifo_count) // output[7:0] - number of 32-byte chunks available in FIFO
); );
pulse_cross_clock eof_written_mclk_i (.rst(rst), .src_clk(~xclk2x), .dst_clk(mclk), .in_pulse(eof_written_xclk2xn), .out_pulse(eof_written_mclk),.busy()); pulse_cross_clock eof_written_mclk_i (.rst(xrst2xn), .src_clk(~xclk2x), .dst_clk(mclk), .in_pulse(eof_written_xclk2xn), .out_pulse(eof_written_mclk),.busy());
// TODO: Add status module to combine/FF, re-clock status signals // TODO: Add status module to combine/FF, re-clock status signals
......
...@@ -42,8 +42,11 @@ ...@@ -42,8 +42,11 @@
// Or make FIFO outside of the stuffer? // Or make FIFO outside of the stuffer?
module stuffer393 ( module stuffer393 (
input rst, // global reset // input rst, // global reset
input mclk, input mclk,
input mrst, // @posedge mclk, sync reset
input xrst, // @posedge xclk, sync reset
// time stamping - will copy time at the end of color_first (later than the first hact after vact in the current frame, but before the next one // time stamping - will copy time at the end of color_first (later than the first hact after vact in the current frame, but before the next one
// and before the data is needed for output // and before the data is needed for output
input ts_pre_stb, // @mclk - 1 cycle before receiving 8 bytes of timestamp data input ts_pre_stb, // @mclk - 1 cycle before receiving 8 bytes of timestamp data
...@@ -414,17 +417,23 @@ end ...@@ -414,17 +417,23 @@ end
// extract strart of frame run from different clock, re-clock from the source // extract strart of frame run from different clock, re-clock from the source
always @ (posedge fradv_clk) color_first_r <= color_first; always @ (posedge fradv_clk) color_first_r <= color_first;
pulse_cross_clock stb_start_i (.rst(rst), .src_clk(fradv_clk), .dst_clk(~clk), .in_pulse(!color_first && color_first_r), .out_pulse(stb_start),.busy()); pulse_cross_clock stb_start_i (.rst(xrst), .src_clk(fradv_clk), .dst_clk(~clk), .in_pulse(!color_first && color_first_r), .out_pulse(stb_start),.busy());
reg rst_nclk;
always @ (negedge clk) rst_nclk <= xrst;
timestamp_fifo timestamp_fifo_i ( timestamp_fifo timestamp_fifo_i (
.rst (rst), // input // .rst (rst), // input
.sclk (mclk), // input .sclk (mclk), // input
.srst (mrst), // input
.pre_stb (ts_pre_stb), // input .pre_stb (ts_pre_stb), // input
.din (ts_data), // input[7:0] .din (ts_data), // input[7:0]
// may use stb_start @ negedge clk // may use stb_start @ negedge clk
.aclk (~clk), //fradv_clk), // input .aclk (~clk), //fradv_clk), // input
.arst (rst_nclk), //fradv_clk), // input
.advance (stb_start), // color_first), // input .advance (stb_start), // color_first), // input
.rclk (~clk), // input .rclk (~clk), // input
.rrst (rst_nclk), //fradv_clk), // input
.rstb (ts_rstb), // input .rstb (ts_rstb), // input
.dout (ts_dout) // output[7:0] reg .dout (ts_dout) // output[7:0] reg
); );
......
...@@ -51,9 +51,11 @@ module event_logger#( ...@@ -51,9 +51,11 @@ module event_logger#(
parameter GPIO_N = 10 // number of GPIO bits to control parameter GPIO_N = 10 // number of GPIO bits to control
)( )(
input rst, // input rst,
input mclk, // system clock input mclk, // system clock
input xclk, // half frequency (80 MHz nominal) input xclk, // was in 353: half frequency (80 MHz nominal)
input mrst, // @ posedge mclk - sync reset
input xrst, // @ posedge xclk - sync reset
// programming interface // programming interface
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
input cmd_stb, // strobe (with first byte) for the command a/d input cmd_stb, // strobe (with first byte) for the command a/d
...@@ -296,12 +298,12 @@ module event_logger#( ...@@ -296,12 +298,12 @@ module event_logger#(
end end
// generate strobes to copy configuration data from mclk to xclk domain // generate strobes to copy configuration data from mclk to xclk domain
pulse_cross_clock i_we_config_imu_xclk (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_imu), .out_pulse(we_config_imu_xclk),.busy()); pulse_cross_clock i_we_config_imu_xclk (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_imu), .out_pulse(we_config_imu_xclk),.busy());
pulse_cross_clock i_we_config_gps_xclk (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_gps), .out_pulse(we_config_gps_xclk),.busy()); pulse_cross_clock i_we_config_gps_xclk (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_gps), .out_pulse(we_config_gps_xclk),.busy());
pulse_cross_clock i_we_config_msg_xclk (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_msg), .out_pulse(we_config_msg_xclk),.busy()); pulse_cross_clock i_we_config_msg_xclk (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_msg), .out_pulse(we_config_msg_xclk),.busy());
pulse_cross_clock i_we_config_rst_xclk (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_rst), .out_pulse(we_config_rst_xclk),.busy()); pulse_cross_clock i_we_config_rst_xclk (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_rst), .out_pulse(we_config_rst_xclk),.busy());
pulse_cross_clock i_we_config_debug_xclk (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_debug), .out_pulse(we_config_debug_xclk),.busy()); pulse_cross_clock i_we_config_debug_xclk (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_config_debug), .out_pulse(we_config_debug_xclk),.busy());
pulse_cross_clock i_we_bitHalfPeriod_xclk (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_bitHalfPeriod), .out_pulse(we_bitHalfPeriod_xclk),.busy()); pulse_cross_clock i_we_bitHalfPeriod_xclk (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(we_bitHalfPeriod), .out_pulse(we_bitHalfPeriod_xclk),.busy());
cmd_deser #( cmd_deser #(
.ADDR (LOGGER_ADDR), .ADDR (LOGGER_ADDR),
...@@ -313,8 +315,9 @@ module event_logger#( ...@@ -313,8 +315,9 @@ module event_logger#(
.ADDR_MASK1 (LOGGER_STATUS_MASK) .ADDR_MASK1 (LOGGER_STATUS_MASK)
) cmd_deser_32bit_i ( ) cmd_deser_32bit_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[3:0] .addr (cmd_a), // output[3:0]
...@@ -327,8 +330,9 @@ module event_logger#( ...@@ -327,8 +330,9 @@ module event_logger#(
.PAYLOAD_BITS (26), .PAYLOAD_BITS (26),
.REGISTER_STATUS (1) .REGISTER_STATUS (1)
) status_generate_i ( ) status_generate_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (cmd_status), // input .we (cmd_status), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status ({sample_counter,2'b0}), // input[25:0] // 2 LSBs - may add "real" status .status ({sample_counter,2'b0}), // input[25:0] // 2 LSBs - may add "real" status
...@@ -378,9 +382,11 @@ fixed-length de-noise circuitry with latency 256*T(xclk) (~3usec) ...@@ -378,9 +382,11 @@ fixed-length de-noise circuitry with latency 256*T(xclk) (~3usec)
/* logs frame synchronization data from other camera (same as frame sync) */ /* logs frame synchronization data from other camera (same as frame sync) */
// ts_stb (mclk) -> trig) // ts_stb (mclk) -> trig)
imu_exttime393 i_imu_exttime( imu_exttime393 i_imu_exttime(
.rst (rst), // input global reset // .rst (rst), // input global reset
.mclk (mclk), // system clock, negedge .mclk (mclk), // system clock, negedge
.xclk (xclk), // half frequency (80 MHz nominal) .xclk (xclk), // half frequency (80 MHz nominal)
.mrst (mrst), // @mclk - sync reset
.xrst (xrst), // @xclk - sync reset
.en_chn_mclk (enable_syn_mclk), // enable module operation, if 0 - reset .en_chn_mclk (enable_syn_mclk), // enable module operation, if 0 - reset
.ts_stb_chn0 (ts_stb_chn0), // input .ts_stb_chn0 (ts_stb_chn0), // input
.ts_data_chn0 (ts_data_chn0), // input[7:0] .ts_data_chn0 (ts_data_chn0), // input[7:0]
......
...@@ -25,9 +25,11 @@ When sensors are running in free running mode, each sensor may provide individua ...@@ -25,9 +25,11 @@ When sensors are running in free running mode, each sensor may provide individua
*/ */
module imu_exttime393( module imu_exttime393(
input rst, // input rst,
input mclk, // system clock, negedge TODO:COnvert to posedge! input mclk, // system clock, negedge TODO:COnvert to posedge!
input xclk, // half frequency (80 MHz nominal) input xclk, // half frequency (80 MHz nominal)
input mrst, // @ posedge mclk - sync reset
input xrst, // @ posedge xclk - sync reset
input [3:0] en_chn_mclk, // enable per-channel module operation, if all 0 - reset input [3:0] en_chn_mclk, // enable per-channel module operation, if all 0 - reset
// byte-parallel timestamps from 4 sensors channels (in triggered mode all are the same, different only in free running mode) // byte-parallel timestamps from 4 sensors channels (in triggered mode all are the same, different only in free running mode)
// each may generate logger event, channel number encoded in bits 25:24 of the external microseconds // each may generate logger event, channel number encoded in bits 25:24 of the external microseconds
...@@ -128,58 +130,70 @@ module imu_exttime393( ...@@ -128,58 +130,70 @@ module imu_exttime393(
timestamp_fifo timestamp_fifo_chn0_i ( timestamp_fifo timestamp_fifo_chn0_i (
.rst (rst), // input // .rst (rst), // input
.sclk (mclk), // input .sclk (mclk), // input
.srst (mrst), // input
.pre_stb (ts_stb[0]), // input .pre_stb (ts_stb[0]), // input
.din (ts_data_chn0), // input[7:0] .din (ts_data_chn0), // input[7:0]
.aclk (mclk), // input .aclk (mclk), // input
.arst (mrst), // input
.advance (ts_stb[0]), // enough time .advance (ts_stb[0]), // enough time
.rclk (mclk), // input .rclk (mclk), // input
.rrst (mrst), // input
.rstb (pre_copy_started && (sel_chn == 2'h0)),// input .rstb (pre_copy_started && (sel_chn == 2'h0)),// input
.dout (dout_chn[0 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1] .dout (dout_chn[0 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1]
); );
timestamp_fifo timestamp_fifo_chn1_i ( timestamp_fifo timestamp_fifo_chn1_i (
.rst (rst), // input // .rst (rst), // input
.sclk (mclk), // input .sclk (mclk), // input
.srst (mrst), // input
.pre_stb (ts_stb[1]), // input .pre_stb (ts_stb[1]), // input
.din (ts_data_chn1), // input[7:0] .din (ts_data_chn1), // input[7:0]
.aclk (mclk), // input .aclk (mclk), // input
.arst (mrst), // input
.advance (ts_stb[1]), // enough time .advance (ts_stb[1]), // enough time
.rclk (mclk), // input .rclk (mclk), // input
.rrst (mrst), // input
.rstb (pre_copy_started && (sel_chn == 2'h1)),// input .rstb (pre_copy_started && (sel_chn == 2'h1)),// input
.dout (dout_chn[1 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1] .dout (dout_chn[1 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1]
); );
timestamp_fifo timestamp_fifo_chn2_i ( timestamp_fifo timestamp_fifo_chn2_i (
.rst (rst), // input // .rst (rst), // input
.sclk (mclk), // input .sclk (mclk), // input
.srst (mrst), // input
.pre_stb (ts_stb[2]), // input .pre_stb (ts_stb[2]), // input
.din (ts_data_chn2), // input[7:0] .din (ts_data_chn2), // input[7:0]
.aclk (mclk), // input .aclk (mclk), // input
.arst (mrst), // input
.advance (ts_stb[2]), // enough time .advance (ts_stb[2]), // enough time
.rclk (mclk), // input .rclk (mclk), // input
.rrst (mrst), // input
.rstb (pre_copy_started && (sel_chn == 2'h2)),// input .rstb (pre_copy_started && (sel_chn == 2'h2)),// input
.dout (dout_chn[2 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1] .dout (dout_chn[2 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1]
); );
timestamp_fifo timestamp_fifo_chn3_i ( timestamp_fifo timestamp_fifo_chn3_i (
.rst (rst), // input // .rst (rst), // input
.sclk (mclk), // input .sclk (mclk), // input
.srst (mrst), // input
.pre_stb (ts_stb[3]), // input .pre_stb (ts_stb[3]), // input
.din (ts_data_chn3), // input[7:0] .din (ts_data_chn3), // input[7:0]
.aclk (mclk), // input .aclk (mclk), // input
.arst (mrst), // input
.advance (ts_stb[3]), // enough time .advance (ts_stb[3]), // enough time
.rclk (mclk), // input .rclk (mclk), // input
.rrst (mrst), // input
.rstb (pre_copy_started && (sel_chn == 2'h3)),// input .rstb (pre_copy_started && (sel_chn == 2'h3)),// input
.dout (dout_chn[3 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1] .dout (dout_chn[3 * 8 +: 8]) // output[7:0] reg valid with copy_selected[1]
); );
pulse_cross_clock i_rd_start_mclk (.rst(1'b0), .src_clk(xclk), .dst_clk(mclk), .in_pulse(rd_start), .out_pulse(rd_start_mclk),.busy()); pulse_cross_clock i_rd_start_mclk (.rst(xrst), .src_clk(xclk), .dst_clk(mclk), .in_pulse(rd_start), .out_pulse(rd_start_mclk),.busy());
// generate timestamp request as soon as one of the sub-channels starts copying. That time stamp will be stored for this (ext) channel // generate timestamp request as soon as one of the sub-channels starts copying. That time stamp will be stored for this (ext) channel
pulse_cross_clock i_ts (.rst(1'b0), .src_clk(mclk), .dst_clk(xclk), .in_pulse(pre_copy_w), .out_pulse(ts),.busy()); pulse_cross_clock i_ts (.rst(mrst), .src_clk(mclk), .dst_clk(xclk), .in_pulse(pre_copy_w), .out_pulse(ts),.busy());
endmodule endmodule
...@@ -30,7 +30,7 @@ module cmd_encod_linear_rd #( ...@@ -30,7 +30,7 @@ module cmd_encod_linear_rd #(
parameter CMD_DONE_BIT= 10, // VDT BUG: CMD_DONE_BIT is used in a function call parameter! parameter CMD_DONE_BIT= 10, // VDT BUG: CMD_DONE_BIT is used in a function call parameter!
parameter RSEL= 1'b1 parameter RSEL= 1'b1
) ( ) (
input rst, input mrst,
input clk, input clk,
// programming interface // programming interface
// input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 // input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
...@@ -90,20 +90,18 @@ module cmd_encod_linear_rd #( ...@@ -90,20 +90,18 @@ module cmd_encod_linear_rd #(
assign rom_skip= rom_r[ENC_PAUSE_SHIFT+:2]; assign rom_skip= rom_r[ENC_PAUSE_SHIFT+:2];
assign full_cmd= rom_cmd[1]?(rom_cmd[0]?CMD_ACTIVATE:CMD_PRECHARGE):(rom_cmd[0]?CMD_READ:CMD_NOP); assign full_cmd= rom_cmd[1]?(rom_cmd[0]?CMD_ACTIVATE:CMD_PRECHARGE):(rom_cmd[0]?CMD_READ:CMD_NOP);
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) gen_run <= 0; if (mrst) gen_run <= 0;
else if (start) gen_run<= 1; else if (start) gen_run<= 1;
else if (pre_done) gen_run<= 0; else if (pre_done) gen_run<= 0;
// if (rst) gen_run_d <= 0;
// else gen_run_d <= gen_run;
if (rst) gen_addr <= 0; if (mrst) gen_addr <= 0;
else if (!start && !gen_run) gen_addr <= 0; else if (!start && !gen_run) gen_addr <= 0;
else if ((gen_addr==(REPEAT_ADDR-1)) && (num128[NUM_XFER_BITS-1:1]==0)) gen_addr <= REPEAT_ADDR+1; // skip loop alltogeter else if ((gen_addr==(REPEAT_ADDR-1)) && (num128[NUM_XFER_BITS-1:1]==0)) gen_addr <= REPEAT_ADDR+1; // skip loop alltogeter
else if ((gen_addr !=REPEAT_ADDR) || (num128[NUM_XFER_BITS-1:1]==0)) gen_addr <= gen_addr+1; // not in a loop else if ((gen_addr !=REPEAT_ADDR) || (num128[NUM_XFER_BITS-1:1]==0)) gen_addr <= gen_addr+1; // not in a loop
//counting loops? //counting loops?
if (rst) num128 <= 0; if (mrst) num128 <= 0;
else if (start) num128 <= num128_in; else if (start) num128 <= num128_in;
else if (!gen_run) num128 <= 0; // else if (!gen_run) num128 <= 0; //
else if ((gen_addr == (REPEAT_ADDR-1)) || (gen_addr == REPEAT_ADDR)) num128 <= num128 -1; else if ((gen_addr == (REPEAT_ADDR-1)) || (gen_addr == REPEAT_ADDR)) num128 <= num128 -1;
...@@ -121,8 +119,8 @@ module cmd_encod_linear_rd #( ...@@ -121,8 +119,8 @@ module cmd_encod_linear_rd #(
end end
// ROM-based (registered output) encoded sequence // ROM-based (registered output) encoded sequence
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) rom_r <= 0; if (mrst) rom_r <= 0;
else case (gen_addr) else case (gen_addr)
4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT); 4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT);
4'h1: rom_r <= (ENC_CMD_NOP << ENC_CMD_SHIFT) | (1 << ENC_PAUSE_SHIFT); 4'h1: rom_r <= (ENC_CMD_NOP << ENC_CMD_SHIFT) | (1 << ENC_PAUSE_SHIFT);
...@@ -136,17 +134,15 @@ module cmd_encod_linear_rd #( ...@@ -136,17 +134,15 @@ module cmd_encod_linear_rd #(
default:rom_r <= 0; default:rom_r <= 0;
endcase endcase
end end
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
// if (rst) done <= 0;
// else done <= pre_done;
if (rst) enc_wr <= 0; if (mrst) enc_wr <= 0;
else enc_wr <= gen_run; // || gen_run_d; else enc_wr <= gen_run; // || gen_run_d;
if (rst) enc_done <= 0; if (mrst) enc_done <= 0;
else enc_done <= enc_wr && !gen_run; // !gen_run_d; else enc_done <= enc_wr && !gen_run; // !gen_run_d;
if (rst) enc_cmd <= 0; if (mrst) enc_cmd <= 0;
else if (gen_run) begin else if (gen_run) begin
if (rom_cmd==0) enc_cmd <= func_encode_skip ( // encode pause if (rom_cmd==0) enc_cmd <= func_encode_skip ( // encode pause
{{CMD_PAUSE_BITS-2{1'b0}},rom_skip[1:0]}, // skip; // number of extra cycles to skip (and keep all the other outputs) {{CMD_PAUSE_BITS-2{1'b0}},rom_skip[1:0]}, // skip; // number of extra cycles to skip (and keep all the other outputs)
...@@ -184,74 +180,5 @@ module cmd_encod_linear_rd #( ...@@ -184,74 +180,5 @@ module cmd_encod_linear_rd #(
// move to include? // move to include?
`include "includes/x393_mcontr_encode_cmd.vh" `include "includes/x393_mcontr_encode_cmd.vh"
/* /endmodule
function [31:0] func_encode_skip;
input [CMD_PAUSE_BITS-1:0] skip; // number of extra cycles to skip (and keep all the other outputs)
input done; // end of sequence
input [2:0] bank; // bank (here OK to be any)
input odt_en; // enable ODT
input cke; // disable CKE
input sel; // first/second half-cycle, other will be nop (cke+odt applicable to both)
input dq_en; // enable (not tristate) DQ lines (internal timing sequencer for 0->1 and 1->0)
input dqs_en; // enable (not tristate) DQS lines (internal timing sequencer for 0->1 and 1->0)
input dqs_toggle; // enable toggle DQS according to the pattern
input dci; // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0)
input buf_wr; // connect to external buffer (but only if not paused)
input buf_rd; // connect to external buffer (but only if not paused)
input buf_rst; // connect to external buffer (but only if not paused)
begin
func_encode_skip= func_encode_cmd (
{{14-CMD_DONE_BIT{1'b0}}, done, skip[CMD_PAUSE_BITS-1:0]}, // 15-bit row/column address
bank[2:0], // bank (here OK to be any)
3'b0, // RAS/CAS/WE, positive logic
odt_en, // enable ODT
cke, // disable CKE
sel, // first/second half-cycle, other will be nop (cke+odt applicable to both)
dq_en, // enable (not tristate) DQ lines (internal timing sequencer for 0->1 and 1->0)
dqs_en, // enable (not tristate) DQS lines (internal timing sequencer for 0->1 and 1->0)
dqs_toggle, // enable toggle DQS according to the pattern
dci, // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0)
buf_wr, // connect to external buffer (but only if not paused)
buf_rd, // connect to external buffer (but only if not paused)
1'b0, // nop
buf_rst);
end
endfunction
function [31:0] func_encode_cmd;
input [14:0] addr; // 15-bit row/column address
input [2:0] bank; // bank (here OK to be any)
input [2:0] rcw; // RAS/CAS/WE, positive logic
input odt_en; // enable ODT
input cke; // disable CKE
input sel; // first/second half-cycle, other will be nop (cke+odt applicable to both)
input dq_en; // enable (not tristate) DQ lines (internal timing sequencer for 0->1 and 1->0)
input dqs_en; // enable (not tristate) DQS lines (internal timing sequencer for 0->1 and 1->0)
input dqs_toggle; // enable toggle DQS according to the pattern
input dci; // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0)
input buf_wr; // connect to external buffer (but only if not paused)
input buf_rd; // connect to external buffer (but only if not paused)
input nop; // add NOP after the current command, keep other data
input buf_rst; // connect to external buffer (but only if not paused)
begin
func_encode_cmd={
addr[14:0], // 15-bit row/column address
bank [2:0], // bank
rcw[2:0], // RAS/CAS/WE
odt_en, // enable ODT
cke, // may be optimized (removed from here)?
sel, // first/second half-cycle, other will be nop (cke+odt applicable to both)
dq_en, // enable (not tristate) DQ lines (internal timing sequencer for 0->1 and 1->0)
dqs_en, // enable (not tristate) DQS lines (internal timing sequencer for 0->1 and 1->0)
dqs_toggle, // enable toggle DQS according to the pattern
dci, // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0)
buf_wr, // phy_buf_wr, // connect to external buffer (but only if not paused)
buf_rd, // phy_buf_rd, // connect to external buffer (but only if not paused)
nop, // add NOP after the current command, keep other data
buf_rst // Reserved for future use
};
end
endfunction
*/
endmodule
...@@ -30,7 +30,7 @@ module cmd_encod_linear_rw#( ...@@ -30,7 +30,7 @@ module cmd_encod_linear_rw#(
parameter RSEL= 1'b1, // late/early READ commands (to adjust timing by 1 SDCLK period) parameter RSEL= 1'b1, // late/early READ commands (to adjust timing by 1 SDCLK period)
parameter WSEL= 1'b0 // late/early WRITE commands (to adjust timing by 1 SDCLK period) parameter WSEL= 1'b0 // late/early WRITE commands (to adjust timing by 1 SDCLK period)
) ( ) (
input rst, input mrst,
input clk, input clk,
// programming interface // programming interface
// input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 // input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
...@@ -63,7 +63,7 @@ module cmd_encod_linear_rw#( ...@@ -63,7 +63,7 @@ module cmd_encod_linear_rw#(
.CMD_DONE_BIT (CMD_DONE_BIT), .CMD_DONE_BIT (CMD_DONE_BIT),
.RSEL (RSEL) .RSEL (RSEL)
) cmd_encod_linear_rd_i ( ) cmd_encod_linear_rd_i (
.rst (rst), // input .mrst (mrst), // input
.clk (clk), // input .clk (clk), // input
.bank_in (bank_in), // input[2:0] .bank_in (bank_in), // input[2:0]
.row_in (row_in), // input[14:0] .row_in (row_in), // input[14:0]
...@@ -84,7 +84,7 @@ module cmd_encod_linear_rw#( ...@@ -84,7 +84,7 @@ module cmd_encod_linear_rw#(
.CMD_DONE_BIT (CMD_DONE_BIT), .CMD_DONE_BIT (CMD_DONE_BIT),
.WSEL (WSEL) .WSEL (WSEL)
) cmd_encod_linear_wr_i ( ) cmd_encod_linear_wr_i (
.rst (rst), // input .mrst (mrst), // input
.clk (clk), // input .clk (clk), // input
.bank_in (bank_in), // input[2:0] .bank_in (bank_in), // input[2:0]
.row_in (row_in), // input[14:0] .row_in (row_in), // input[14:0]
...@@ -97,11 +97,11 @@ module cmd_encod_linear_rw#( ...@@ -97,11 +97,11 @@ module cmd_encod_linear_rw#(
.enc_done (enc_done_wr) // output reg .enc_done (enc_done_wr) // output reg
); );
always @(posedge rst or posedge clk) begin always @(posedge clk) begin
if (rst) start <= 0; if (mrst) start <= 0;
else start <= start_rd || start_wr; else start <= start_rd || start_wr;
if (rst) select_wr <= 0; if (mrst) select_wr <= 0;
else if (start_rd) select_wr <= 0; else if (start_rd) select_wr <= 0;
else if (start_wr) select_wr <= 1; else if (start_wr) select_wr <= 1;
end end
......
...@@ -29,7 +29,7 @@ module cmd_encod_linear_wr #( ...@@ -29,7 +29,7 @@ module cmd_encod_linear_wr #(
parameter CMD_DONE_BIT= 10, // VDT BUG: CMD_DONE_BIT is used in a function call parameter! parameter CMD_DONE_BIT= 10, // VDT BUG: CMD_DONE_BIT is used in a function call parameter!
parameter WSEL= 1'b0 parameter WSEL= 1'b0
) ( ) (
input rst, input mrst,
input clk, input clk,
// programming interface // programming interface
input [2:0] bank_in, // bank address input [2:0] bank_in, // bank address
...@@ -117,58 +117,39 @@ module cmd_encod_linear_wr #( ...@@ -117,58 +117,39 @@ module cmd_encod_linear_wr #(
start_d <= start; start_d <= start;
cut_buf_rd <= rom_r[ENC_BUF_RD] && (cut_buf_rd || next_zero_w); cut_buf_rd <= rom_r[ENC_BUF_RD] && (cut_buf_rd || next_zero_w);
end end
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) gen_run <= 0; if (mrst) gen_run <= 0;
else if (start) gen_run<= 1; else if (start) gen_run<= 1;
else if (pre_done) gen_run<= 0; else if (pre_done) gen_run<= 0;
// if (rst) gen_run_d <= 0; if (mrst) gen_addr <= 0;
// else gen_run_d <= gen_run;
if (rst) gen_addr <= 0;
else if (!start && !gen_run) gen_addr <= 0; else if (!start && !gen_run) gen_addr <= 0;
else if ((gen_addr==(REPEAT_ADDR-1)) && few_write) gen_addr <= jump_gen_addr; else if ((gen_addr==(REPEAT_ADDR-1)) && few_write) gen_addr <= jump_gen_addr;
// else if ((gen_addr !=REPEAT_ADDR) || (num128[NUM_XFER_BITS:1]==0)) gen_addr <= gen_addr+1; // not in a loop
// else if ((gen_addr !=REPEAT_ADDR) || (num128==2)) gen_addr <= gen_addr+1; // not in a loop
else if ((gen_addr !=REPEAT_ADDR) || (num128[NUM_XFER_BITS:2]==0)) gen_addr <= gen_addr+1; // not in a loop else if ((gen_addr !=REPEAT_ADDR) || (num128[NUM_XFER_BITS:2]==0)) gen_addr <= gen_addr+1; // not in a loop
//counting loops //counting loops
if (rst) num128 <= 0; if (mrst) num128 <= 0;
else if (start) num128 <= {(num128_in==0)?1'b1:1'b0,num128_in}; else if (start) num128 <= {(num128_in==0)?1'b1:1'b0,num128_in};
else if (!gen_run) num128 <= 0; // else if (!gen_run) num128 <= 0; //
// else if ((gen_addr == (REPEAT_ADDR-1)) || (gen_addr == REPEAT_ADDR)) num128 <= num128 -1; // ????? - FIXME
else if (write_addr_w) num128 <= num128 -1; else if (write_addr_w) num128 <= num128 -1;
if (rst) single_write <= 0; if (mrst) single_write <= 0;
else if (start_d) single_write <= (num128[NUM_XFER_BITS:1]==0); // could not be 0 else if (start_d) single_write <= (num128[NUM_XFER_BITS:1]==0); // could not be 0
if (rst) dual_write <= 0; if (mrst) dual_write <= 0;
else if (start_d) dual_write <= (num128==2); else if (start_d) dual_write <= (num128==2);
// if (rst) triple_write <= 0; if (mrst) few_write <= 0;
// else if (start_d) triple_write <= (num128==3);
if (rst) few_write <= 0;
else if (start_d) few_write <=(num128[NUM_XFER_BITS:2]==0); // (0,)1,2 or3 else if (start_d) few_write <=(num128[NUM_XFER_BITS:2]==0); // (0,)1,2 or3
//
// if (rst) few_write <= 0;
// else few_write <= single_write | dual_write | triple_write;
if (rst) jump_gen_addr <= 0; if (mrst) jump_gen_addr <= 0;
else jump_gen_addr <= single_write ? NO_WRITE_ADDR : (dual_write ? LAST_WRITE_ADDR : PRELAST_WRITE_ADDR); else jump_gen_addr <= single_write ? NO_WRITE_ADDR : (dual_write ? LAST_WRITE_ADDR : PRELAST_WRITE_ADDR);
//triple_write
// reg single_write; // only one burst has to be written
// reg dual_write; // Two bursts have to be written
end end
always @ (posedge clk) if (start) begin always @ (posedge clk) if (start) begin
row<=row_in; row<=row_in;
// col <= start_col;
bank <= bank_in; bank <= bank_in;
skip_next_page <= skip_next_page_in; skip_next_page <= skip_next_page_in;
end end
...@@ -180,8 +161,8 @@ module cmd_encod_linear_wr #( ...@@ -180,8 +161,8 @@ module cmd_encod_linear_wr #(
// ROM-based (registered output) encoded sequence // ROM-based (registered output) encoded sequence
// TODO: Remove last ENC_BUF_RD // TODO: Remove last ENC_BUF_RD
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) rom_r <= 0; if (mrst) rom_r <= 0;
else case (gen_addr) else case (gen_addr)
4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD);// | (1 << ENC_NOP); 4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD);// | (1 << ENC_NOP);
4'h1: rom_r <= (ENC_CMD_NOP << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD); 4'h1: rom_r <= (ENC_CMD_NOP << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD);
...@@ -203,18 +184,16 @@ module cmd_encod_linear_wr #( ...@@ -203,18 +184,16 @@ module cmd_encod_linear_wr #(
default:rom_r <= 0; default:rom_r <= 0;
endcase endcase
end end
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
// if (rst) done <= 0;
// else done <= pre_done;
if (rst) enc_wr <= 0; if (mrst) enc_wr <= 0;
else enc_wr <= gen_run; // || gen_run_d; else enc_wr <= gen_run; // || gen_run_d;
if (rst) enc_done <= 0; if (mrst) enc_done <= 0;
// else enc_done <= enc_wr || !gen_run_d; // else enc_done <= enc_wr || !gen_run_d;
else enc_done <= enc_wr && !gen_run; // !gen_run_d; else enc_done <= enc_wr && !gen_run; // !gen_run_d;
if (rst) enc_cmd <= 0; if (mrst) enc_cmd <= 0;
else if (gen_run) begin else if (gen_run) begin
if (rom_cmd==0) enc_cmd <= func_encode_skip ( // encode pause if (rom_cmd==0) enc_cmd <= func_encode_skip ( // encode pause
{{CMD_PAUSE_BITS-2{1'b0}},rom_skip[1:0]}, // skip; // number of extra cycles to skip (and keep all the other outputs) {{CMD_PAUSE_BITS-2{1'b0}},rom_skip[1:0]}, // skip; // number of extra cycles to skip (and keep all the other outputs)
......
...@@ -51,7 +51,7 @@ module cmd_encod_tiled_rd #( ...@@ -51,7 +51,7 @@ module cmd_encod_tiled_rd #(
parameter FRAME_WIDTH_BITS= 13, // Maximal frame width - 8-word (16 bytes) bursts parameter FRAME_WIDTH_BITS= 13, // Maximal frame width - 8-word (16 bytes) bursts
parameter RSEL= 1'b1 parameter RSEL= 1'b1
) ( ) (
input rst, input mrst,
input clk, input clk,
// programming interface // programming interface
input [2:0] start_bank, // bank address input [2:0] start_bank, // bank address
...@@ -157,56 +157,52 @@ module cmd_encod_tiled_rd #( ...@@ -157,56 +157,52 @@ module cmd_encod_tiled_rd #(
assign pre_read= rom_r[ENC_CMD_SHIFT]; //1 cycle before READ command assign pre_read= rom_r[ENC_CMD_SHIFT]; //1 cycle before READ command
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) gen_run <= 0; if (mrst) gen_run <= 0;
else if (start_d) gen_run<= 1; // delaying else if (start_d) gen_run<= 1; // delaying
else if (pre_done) gen_run<= 0; else if (pre_done) gen_run<= 0;
// if (rst) gen_run_d <= 0; if (mrst) num_rows_m1 <= 0;
// else gen_run_d <= gen_run; else if (start ) num_rows_m1 <= num_rows_in_m1; // number of rows
if (mrst) num_cols128_m1 <= 0;
if (rst) num_rows_m1 <= 0;
else if (start) num_rows_m1 <= num_rows_in_m1; // number of rows
if (rst) num_cols128_m1 <= 0;
else if (start) num_cols128_m1 <= num_cols_in_m1; // number of r16-byte columns else if (start) num_cols128_m1 <= num_cols_in_m1; // number of r16-byte columns
if (rst) start_d <=0; if (mrst) start_d <=0;
else start_d <= start; else start_d <= start;
if (rst) top_rc <= 0; if (mrst) top_rc <= 0;
else if (start_d) top_rc <= {row,col}+1; else if (start_d) top_rc <= {row,col}+1;
else if (pre_act && last_row) top_rc <= top_rc+1; // may increment RA else if (pre_act && last_row) top_rc <= top_rc+1; // may increment RA
if (rst) row_col_bank <= 0; if (mrst) row_col_bank <= 0;
else if (start_d) row_col_bank <= {row,col,bank}; // TODO: Use start_col,... and start, not start_d? else if (start_d) row_col_bank <= {row,col,bank}; // TODO: Use start_col,... and start, not start_d?
else if (pre_act) row_col_bank <= row_col_bank_next_w; else if (pre_act) row_col_bank <= row_col_bank_next_w;
if (rst) scan_row <= 0; if (mrst) scan_row <= 0;
else if (start_d) scan_row <= 0; else if (start_d) scan_row <= 0;
else if (pre_act) scan_row <= last_row?0:scan_row+1; else if (pre_act) scan_row <= last_row?0:scan_row+1;
if (rst) scan_col <= 0; if (mrst) scan_col <= 0;
else if (start_d) scan_col <= 0; else if (start_d) scan_col <= 0;
else if (pre_act && last_row) scan_col <= scan_col+1; // for ACTIVATE, not for READ else if (pre_act && last_row) scan_col <= scan_col+1; // for ACTIVATE, not for READ
if (rst) first_col <= 0; if (mrst) first_col <= 0;
else if (start_d) first_col <= 1; else if (start_d) first_col <= 1;
else if (pre_act && last_row) first_col <= 0; else if (pre_act && last_row) first_col <= 0;
if (rst) last_col <= 0; if (mrst) last_col <= 0;
else if (start_d) last_col <= num_cols128_m1==0; // if single column - will start with 1'b1; else if (start_d) last_col <= num_cols128_m1==0; // if single column - will start with 1'b1;
else if (pre_act) last_col <= (scan_col==num_cols128_m1); // too early for READ ? else if (pre_act) last_col <= (scan_col==num_cols128_m1); // too early for READ ?
if (rst) enable_autopre <= 0; if (mrst) enable_autopre <= 0;
else if (start_d) enable_autopre <= 0; else if (start_d) enable_autopre <= 0;
else if (pre_act) enable_autopre <= last_col || !keep_open; // delayed by 2 pre_act tacts form last_col, OK with a single column else if (pre_act) enable_autopre <= last_col || !keep_open; // delayed by 2 pre_act tacts form last_col, OK with a single column
if (rst) loop_continue<=0; if (mrst) loop_continue<=0;
else loop_continue <= (scan_col==num_cols128_m1) && last_row; else loop_continue <= (scan_col==num_cols128_m1) && last_row;
if (rst) gen_addr <= 0; if (mrst) gen_addr <= 0;
else if (!start_d && !gen_run) gen_addr <= 0; else if (!start_d && !gen_run) gen_addr <= 0;
else if ((gen_addr==LOOP_LAST) && !loop_continue) gen_addr <= LOOP_FIRST; // skip loop alltogeter else if ((gen_addr==LOOP_LAST) && !loop_continue) gen_addr <= LOOP_FIRST; // skip loop alltogeter
else gen_addr <= gen_addr+1; // not in a loop else gen_addr <= gen_addr+1; // not in a loop
...@@ -222,8 +218,8 @@ module cmd_encod_tiled_rd #( ...@@ -222,8 +218,8 @@ module cmd_encod_tiled_rd #(
end end
// ROM-based (registered output) encoded sequence // ROM-based (registered output) encoded sequence
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) rom_r <= 0; if (mrst) rom_r <= 0;
else case (gen_addr) else case (gen_addr)
4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_NOP) | (1 << ENC_PAUSE_SHIFT); // here does not matter, just to work with masked ACTIVATE 4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_NOP) | (1 << ENC_PAUSE_SHIFT); // here does not matter, just to work with masked ACTIVATE
4'h1: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT); 4'h1: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT);
...@@ -241,18 +237,15 @@ module cmd_encod_tiled_rd #( ...@@ -241,18 +237,15 @@ module cmd_encod_tiled_rd #(
default:rom_r <= 0; default:rom_r <= 0;
endcase endcase
end end
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
// if (rst) done <= 0;
// else done <= pre_done;
if (rst) enc_wr <= 0; if (mrst) enc_wr <= 0;
else enc_wr <= gen_run; // || gen_run_d; else enc_wr <= gen_run; // || gen_run_d;
if (rst) enc_done <= 0; if (mrst) enc_done <= 0;
else enc_done <= enc_wr && !gen_run; // !gen_run_d; else enc_done <= enc_wr && !gen_run; // !gen_run_d;
if (rst) enc_cmd <= 0; if (mrst) enc_cmd <= 0;
// else if ((rom_cmd==0) || (rom_cmd[1] && !enable_act)) enc_cmd <= func_encode_skip ( // encode pause
else if (gen_run) begin else if (gen_run) begin
if (rom_cmd[0] || (rom_cmd[1] && enable_act)) enc_cmd <= func_encode_cmd ( // encode non-NOP command if (rom_cmd[0] || (rom_cmd[1] && enable_act)) enc_cmd <= func_encode_cmd ( // encode non-NOP command
rom_cmd[1]? // activate rom_cmd[1]? // activate
...@@ -295,7 +288,7 @@ module cmd_encod_tiled_rd #( ...@@ -295,7 +288,7 @@ module cmd_encod_tiled_rd #(
fifo_2regs #( fifo_2regs #(
.WIDTH(COLADDR_NUMBER) .WIDTH(COLADDR_NUMBER)
) fifo_2regs_i ( ) fifo_2regs_i (
.rst (rst), // input .mrst (mrst), // input
.clk (clk), // input .clk (clk), // input
.din (row_col_bank[COLADDR_NUMBER-1:0]), // input[15:0] .din (row_col_bank[COLADDR_NUMBER-1:0]), // input[15:0]
.wr(pre_act), // input .wr(pre_act), // input
......
...@@ -29,7 +29,7 @@ module cmd_encod_tiled_rw #( ...@@ -29,7 +29,7 @@ module cmd_encod_tiled_rw #(
parameter RSEL= 1'b1, // late/early READ commands (to adjust timing by 1 SDCLK period) parameter RSEL= 1'b1, // late/early READ commands (to adjust timing by 1 SDCLK period)
parameter WSEL= 1'b0 // late/early WRITE commands (to adjust timing by 1 SDCLK period) parameter WSEL= 1'b0 // late/early WRITE commands (to adjust timing by 1 SDCLK period)
) ( ) (
input rst, input mrst,
input clk, input clk,
// programming interface // programming interface
input [2:0] start_bank, // bank address input [2:0] start_bank, // bank address
...@@ -62,7 +62,7 @@ module cmd_encod_tiled_rw #( ...@@ -62,7 +62,7 @@ module cmd_encod_tiled_rw #(
.CMD_DONE_BIT (CMD_DONE_BIT), .CMD_DONE_BIT (CMD_DONE_BIT),
.RSEL (RSEL) .RSEL (RSEL)
) cmd_encod_tiled_rd_i ( ) cmd_encod_tiled_rd_i (
.rst (rst), // input .mrst (mrst), // input
.clk (clk), // input .clk (clk), // input
.start_bank (start_bank), // input[2:0] .start_bank (start_bank), // input[2:0]
.start_row (start_row), // input[14:0] .start_row (start_row), // input[14:0]
...@@ -86,7 +86,7 @@ module cmd_encod_tiled_rw #( ...@@ -86,7 +86,7 @@ module cmd_encod_tiled_rw #(
.CMD_DONE_BIT (CMD_DONE_BIT), .CMD_DONE_BIT (CMD_DONE_BIT),
.WSEL (WSEL) .WSEL (WSEL)
) cmd_encod_tiled_wr_i ( ) cmd_encod_tiled_wr_i (
.rst (rst), // input .mrst (mrst), // input
.clk (clk), // input .clk (clk), // input
.start_bank (start_bank), // input[2:0] .start_bank (start_bank), // input[2:0]
.start_row (start_row), // input[14:0] .start_row (start_row), // input[14:0]
...@@ -103,11 +103,11 @@ module cmd_encod_tiled_rw #( ...@@ -103,11 +103,11 @@ module cmd_encod_tiled_rw #(
.enc_done (enc_done_wr) // output reg .enc_done (enc_done_wr) // output reg
); );
always @(posedge rst or posedge clk) begin always @(posedge clk) begin
if (rst) start <= 0; if (mrst) start <= 0;
else start <= start_rd || start_wr; else start <= start_rd || start_wr;
if (rst) select_wr <= 0; if (mrst) select_wr <= 0;
else if (start_rd) select_wr <= 0; else if (start_rd) select_wr <= 0;
else if (start_wr) select_wr <= 1; else if (start_wr) select_wr <= 1;
end end
......
...@@ -52,7 +52,7 @@ module cmd_encod_tiled_wr #( ...@@ -52,7 +52,7 @@ module cmd_encod_tiled_wr #(
parameter FRAME_WIDTH_BITS= 13, // Maximal frame width - 8-word (16 bytes) bursts parameter FRAME_WIDTH_BITS= 13, // Maximal frame width - 8-word (16 bytes) bursts
parameter WSEL= 1'b0 parameter WSEL= 1'b0
) ( ) (
input rst, input mrst,
input clk, input clk,
// programming interface // programming interface
input [2:0] start_bank, // bank address input [2:0] start_bank, // bank address
...@@ -164,57 +164,54 @@ module cmd_encod_tiled_wr #( ...@@ -164,57 +164,54 @@ module cmd_encod_tiled_wr #(
assign pre_write= rom_r[ENC_CMD_SHIFT]; //1 cycle before READ command assign pre_write= rom_r[ENC_CMD_SHIFT]; //1 cycle before READ command
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) gen_run <= 0; if (mrst) gen_run <= 0;
else if (start_d) gen_run<= 1; // delaying else if (start_d) gen_run<= 1; // delaying
else if (pre_done) gen_run<= 0; else if (pre_done) gen_run<= 0;
// if (rst) gen_run_d <= 0; if (mrst) num_rows_m1 <= 0;
// else gen_run_d <= gen_run;
if (rst) num_rows_m1 <= 0;
else if (start) num_rows_m1 <= num_rows_in_m1; // number of rows else if (start) num_rows_m1 <= num_rows_in_m1; // number of rows
if (rst) num_cols128_m1 <= 0; if (mrst) num_cols128_m1 <= 0;
else if (start) num_cols128_m1 <= num_cols_in_m1; // number of r16-byte columns else if (start) num_cols128_m1 <= num_cols_in_m1; // number of r16-byte columns
if (rst) start_d <=0; if (mrst) start_d <=0;
else start_d <= start; else start_d <= start;
if (rst) top_rc <= 0; if (mrst) top_rc <= 0;
else if (start_d) top_rc <= {row,col}+1; else if (start_d) top_rc <= {row,col}+1;
else if (pre_act && last_row) top_rc <= top_rc+1; // may increment RA else if (pre_act && last_row) top_rc <= top_rc+1; // may increment RA
if (rst) row_col_bank <= 0; if (mrst) row_col_bank <= 0;
else if (start_d) row_col_bank <= {row,col,bank}; // TODO: Use start_col,... and start, not start_d? else if (start_d) row_col_bank <= {row,col,bank}; // TODO: Use start_col,... and start, not start_d?
else if (pre_act) row_col_bank <= row_col_bank_next_w; else if (pre_act) row_col_bank <= row_col_bank_next_w;
if (rst) scan_row <= 0; if (mrst) scan_row <= 0;
else if (start_d) scan_row <= 0; else if (start_d) scan_row <= 0;
else if (pre_act) scan_row <= last_row?0:scan_row+1; else if (pre_act) scan_row <= last_row?0:scan_row+1;
if (rst) scan_col <= 0; if (mrst) scan_col <= 0;
else if (start_d) scan_col <= 0; else if (start_d) scan_col <= 0;
else if (pre_act && last_row) scan_col <= scan_col+1; // for ACTIVATE, not for READ else if (pre_act && last_row) scan_col <= scan_col+1; // for ACTIVATE, not for READ
if (rst) first_col <= 0; if (mrst) first_col <= 0;
else if (start_d) first_col <= 1; else if (start_d) first_col <= 1;
else if (pre_act && last_row) first_col <= 0; else if (pre_act && last_row) first_col <= 0;
if (rst) last_col <= 0; if (mrst) last_col <= 0;
else if (start_d) last_col <= num_cols128_m1==0; // if single column - will start with 1'b1; else if (start_d) last_col <= num_cols128_m1==0; // if single column - will start with 1'b1;
else if (pre_act) last_col <= (scan_col==num_cols128_m1); // too early for READ ? else if (pre_act) last_col <= (scan_col==num_cols128_m1); // too early for READ ?
if (rst) enable_autopre <= 0; if (mrst) enable_autopre <= 0;
else if (start_d) enable_autopre <= 0; else if (start_d) enable_autopre <= 0;
else if (pre_act) enable_autopre <= last_col || !keep_open; // delayed by 2 pre_act tacts form last_col, OK with a single column else if (pre_act) enable_autopre <= last_col || !keep_open; // delayed by 2 pre_act tacts form last_col, OK with a single column
if (rst) loop_continue<=0; if (mrst) loop_continue<=0;
else loop_continue <= (scan_col==num_cols128_m1) && last_row; else loop_continue <= (scan_col==num_cols128_m1) && last_row;
if (rst) gen_addr <= 0; if (mrst) gen_addr <= 0;
else if (!start_d && !gen_run) gen_addr <= 0; else if (!start_d && !gen_run) gen_addr <= 0;
else if ((gen_addr==LOOP_LAST) && !loop_continue) gen_addr <= LOOP_FIRST; // skip loop alltogeter else if ((gen_addr==LOOP_LAST) && !loop_continue) gen_addr <= LOOP_FIRST; // skip loop alltogeter
else gen_addr <= gen_addr+1; // not in a loop else gen_addr <= gen_addr+1; // not in a loop
...@@ -230,14 +227,13 @@ module cmd_encod_tiled_wr #( ...@@ -230,14 +227,13 @@ module cmd_encod_tiled_wr #(
end end
// ROM-based (registered output) encoded sequence // ROM-based (registered output) encoded sequence
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) rom_r <= 0; if (mrst) rom_r <= 0;
else case (gen_addr) else case (gen_addr)
4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) ; // here does not matter, just to work with masked ACTIVATE 4'h0: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) ; // here does not matter, just to work with masked ACTIVATE
4'h1: rom_r <= (ENC_CMD_NOP << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) ; 4'h1: rom_r <= (ENC_CMD_NOP << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) ;
4'h2: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL); 4'h2: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL);
4'h3: rom_r <= (ENC_CMD_WRITE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT); 4'h3: rom_r <= (ENC_CMD_WRITE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT);
// 4'h4: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT) | (1 << ENC_DQ_DQS_EN);
4'h4: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT); 4'h4: rom_r <= (ENC_CMD_ACTIVATE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT);
4'h5: rom_r <= (ENC_CMD_WRITE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT) | (1 << ENC_DQ_DQS_EN) | (1 << ENC_DQS_TOGGLE); 4'h5: rom_r <= (ENC_CMD_WRITE << ENC_CMD_SHIFT) | (1 << ENC_BUF_RD) | (WSEL << ENC_SEL) | (1 << ENC_ODT) | (1 << ENC_DQ_DQS_EN) | (1 << ENC_DQS_TOGGLE);
// start loop // start loop
...@@ -252,16 +248,14 @@ module cmd_encod_tiled_wr #( ...@@ -252,16 +248,14 @@ module cmd_encod_tiled_wr #(
default:rom_r <= 0; default:rom_r <= 0;
endcase endcase
end end
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
// if (rst) done <= 0; if (mrst) enc_wr <= 0;
// else done <= pre_done;
if (rst) enc_wr <= 0;
else enc_wr <= gen_run || gen_run; // gen_run_d; ***** else enc_wr <= gen_run || gen_run; // gen_run_d; *****
if (rst) enc_done <= 0; if (mrst) enc_done <= 0;
else enc_done <= enc_wr && !gen_run; // !gen_run_d; ***** else enc_done <= enc_wr && !gen_run; // !gen_run_d; *****
if (rst) enc_cmd <= 0; if (mrst) enc_cmd <= 0;
else if (gen_run) begin else if (gen_run) begin
if (rom_cmd[0] || (rom_cmd[1] && enable_act)) enc_cmd <= func_encode_cmd ( // encode non-NOP command if (rom_cmd[0] || (rom_cmd[1] && enable_act)) enc_cmd <= func_encode_cmd ( // encode non-NOP command
rom_cmd[1]? // activate rom_cmd[1]? // activate
...@@ -304,7 +298,7 @@ module cmd_encod_tiled_wr #( ...@@ -304,7 +298,7 @@ module cmd_encod_tiled_wr #(
fifo_2regs #( fifo_2regs #(
.WIDTH(COLADDR_NUMBER) .WIDTH(COLADDR_NUMBER)
) fifo_2regs_i ( ) fifo_2regs_i (
.rst (rst), // input .mrst (rst), // input
.clk (clk), // input .clk (clk), // input
.din (row_col_bank[COLADDR_NUMBER-1:0]), // input[15:0] .din (row_col_bank[COLADDR_NUMBER-1:0]), // input[15:0]
.wr(pre_act), // input .wr(pre_act), // input
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
`timescale 1ns/1ps `timescale 1ns/1ps
module ddr_refresh( module ddr_refresh(
input rst, input mrst,
input clk, input clk,
input en, input en,
input [7:0] refresh_period, // in 16*clk, 0 - disable refresh, turn off requests input [7:0] refresh_period, // in 16*clk, 0 - disable refresh, turn off requests
...@@ -39,38 +39,38 @@ module ddr_refresh( ...@@ -39,38 +39,38 @@ module ddr_refresh(
reg en_refresh; reg en_refresh;
reg en_r; reg en_r;
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) en_r <= 0; if (mrst) en_r <= 0;
else en_r <= en; else en_r <= en;
if (rst) en_refresh <= 0; if (mrst) en_refresh <= 0;
else if (set) en_refresh <= (refresh_period != 0); else if (set) en_refresh <= (refresh_period != 0);
if (rst) pre_div <= 0; if (mrst) pre_div <= 0;
else if (set || !en_refresh) pre_div <= 0; else if (set || !en_refresh) pre_div <= 0;
else pre_div <= pre_div +1; else pre_div <= pre_div +1;
if (rst) cry <= 0; if (mrst) cry <= 0;
else if (set) cry <= 0; else if (set) cry <= 0;
else cry <= (pre_div == 4'hf); else cry <= (pre_div == 4'hf);
if (rst) period_cntr <= 0; if (mrst) period_cntr <= 0;
else if (set) period_cntr <= 0; else if (set) period_cntr <= 0;
else if (over) period_cntr <= refresh_period; else if (over) period_cntr <= refresh_period;
else if (cry) period_cntr <= period_cntr -1; else if (cry) period_cntr <= period_cntr -1;
if (rst) refresh_due <= 0; if (mrst) refresh_due <= 0;
else refresh_due <= over; else refresh_due <= over;
if (rst) pending_rq <= 0; if (mrst) pending_rq <= 0;
else if (set) pending_rq <= 0; else if (set) pending_rq <= 0;
else if ( refresh_due && !grant) pending_rq <= pending_rq+1; else if ( refresh_due && !grant) pending_rq <= pending_rq+1;
else if (!refresh_due && grant) pending_rq <= pending_rq-1; else if (!refresh_due && grant) pending_rq <= pending_rq-1;
if (rst) want <= 0; if (mrst) want <= 0;
else want<= en_refresh && en_r && (pending_rq != 0); else want<= en_refresh && en_r && (pending_rq != 0);
if (rst) need <= 0; if (mrst) need <= 0;
else need <= en_refresh && en_r && (pending_rq[4:3] != 0); else need <= en_refresh && en_r && (pending_rq[4:3] != 0);
end end
endmodule endmodule
......
...@@ -229,7 +229,10 @@ module mcntrl393 #( ...@@ -229,7 +229,10 @@ module mcntrl393 #(
input rst_in, input rst_in,
input clk_in, input clk_in,
output mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port output mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
input mrst, // @posedge mclk synchronous reset - should not interrupt mclk generation
output locked, // to generate sync reset
output ref_clk, // global clock for idelay_ctrl calibration output ref_clk, // global clock for idelay_ctrl calibration
output idelay_ctrl_reset,
// programming interface // programming interface
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
input cmd_stb, // strobe (with first byte) for the command a/d input cmd_stb, // strobe (with first byte) for the command a/d
...@@ -386,7 +389,7 @@ module mcntrl393 #( ...@@ -386,7 +389,7 @@ module mcntrl393 #(
localparam COL_WDTH = COLADDR_NUMBER-3; // number of column address bits in bursts localparam COL_WDTH = COLADDR_NUMBER-3; // number of column address bits in bursts
localparam FRAME_WBP1 = FRAME_WIDTH_BITS + 1; localparam FRAME_WBP1 = FRAME_WIDTH_BITS + 1;
wire rst=rst_in; wire rrst=rst_in;
wire axi_rst=rst_in; wire axi_rst=rst_in;
// Not yet connected // Not yet connected
...@@ -816,8 +819,9 @@ module mcntrl393 #( ...@@ -816,8 +819,9 @@ module mcntrl393 #(
end end
//axiwr_waddr //axiwr_waddr
status_router16 status_router16_mctrl_top_i ( status_router16 status_router16_mctrl_top_i (
.rst (rst), // input .rst (1'b0), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.db_in0 (status_mcontr_ad), // input[7:0] .db_in0 (status_mcontr_ad), // input[7:0]
.rq_in0 (status_mcontr_rq), // input .rq_in0 (status_mcontr_rq), // input
.start_in0 (status_mcontr_start), // output .start_in0 (status_mcontr_start), // output
...@@ -1045,7 +1049,7 @@ module mcntrl393 #( ...@@ -1045,7 +1049,7 @@ module mcntrl393 #(
.MCNTRL_SCANLINE_PENDING_CNTR_BITS (MCNTRL_SCANLINE_PENDING_CNTR_BITS), .MCNTRL_SCANLINE_PENDING_CNTR_BITS (MCNTRL_SCANLINE_PENDING_CNTR_BITS),
.MCNTRL_SCANLINE_FRAME_PAGE_RESET (MCNTRL_SCANLINE_FRAME_PAGE_RESET) .MCNTRL_SCANLINE_FRAME_PAGE_RESET (MCNTRL_SCANLINE_FRAME_PAGE_RESET)
) mcntrl_linear_wr_sensor_i ( ) mcntrl_linear_wr_sensor_i (
.rst (rst), // input .mrst (mrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_sens_ad), // input[7:0] .cmd_ad (cmd_sens_ad), // input[7:0]
.cmd_stb (cmd_sens_stb), // input .cmd_stb (cmd_sens_stb), // input
...@@ -1097,7 +1101,7 @@ module mcntrl393 #( ...@@ -1097,7 +1101,7 @@ module mcntrl393 #(
.MCNTRL_TILED_PENDING_CNTR_BITS(MCNTRL_TILED_PENDING_CNTR_BITS), .MCNTRL_TILED_PENDING_CNTR_BITS(MCNTRL_TILED_PENDING_CNTR_BITS),
.MCNTRL_TILED_FRAME_PAGE_RESET (MCNTRL_TILED_FRAME_PAGE_RESET) .MCNTRL_TILED_FRAME_PAGE_RESET (MCNTRL_TILED_FRAME_PAGE_RESET)
) mcntrl_tiled_rd_compressor_i ( ) mcntrl_tiled_rd_compressor_i (
.rst (rst), // input .mrst (mrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_cmprs_ad), // input[7:0] .cmd_ad (cmd_cmprs_ad), // input[7:0]
.cmd_stb (cmd_cmprs_stb), // input .cmd_stb (cmd_cmprs_stb), // input
...@@ -1158,7 +1162,7 @@ module mcntrl393 #( ...@@ -1158,7 +1162,7 @@ module mcntrl393 #(
.MCNTRL_SCANLINE_PENDING_CNTR_BITS (MCNTRL_SCANLINE_PENDING_CNTR_BITS), .MCNTRL_SCANLINE_PENDING_CNTR_BITS (MCNTRL_SCANLINE_PENDING_CNTR_BITS),
.MCNTRL_SCANLINE_FRAME_PAGE_RESET (MCNTRL_SCANLINE_FRAME_PAGE_RESET) .MCNTRL_SCANLINE_FRAME_PAGE_RESET (MCNTRL_SCANLINE_FRAME_PAGE_RESET)
) mcntrl_linear_rw_chn1_i ( ) mcntrl_linear_rw_chn1_i (
.rst (rst), // input .mrst (mrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_scanline_chn1_ad), // input[7:0] .cmd_ad (cmd_scanline_chn1_ad), // input[7:0]
.cmd_stb (cmd_scanline_chn1_stb), // input .cmd_stb (cmd_scanline_chn1_stb), // input
...@@ -1208,7 +1212,7 @@ module mcntrl393 #( ...@@ -1208,7 +1212,7 @@ module mcntrl393 #(
.MCNTRL_SCANLINE_PENDING_CNTR_BITS (MCNTRL_SCANLINE_PENDING_CNTR_BITS), .MCNTRL_SCANLINE_PENDING_CNTR_BITS (MCNTRL_SCANLINE_PENDING_CNTR_BITS),
.MCNTRL_SCANLINE_FRAME_PAGE_RESET (MCNTRL_SCANLINE_FRAME_PAGE_RESET) .MCNTRL_SCANLINE_FRAME_PAGE_RESET (MCNTRL_SCANLINE_FRAME_PAGE_RESET)
) mcntrl_linear_rw_chn3_i ( ) mcntrl_linear_rw_chn3_i (
.rst (rst), // input .mrst (mrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_scanline_chn3_ad), // input[7:0] .cmd_ad (cmd_scanline_chn3_ad), // input[7:0]
.cmd_stb (cmd_scanline_chn3_stb), // input .cmd_stb (cmd_scanline_chn3_stb), // input
...@@ -1260,8 +1264,8 @@ module mcntrl393 #( ...@@ -1260,8 +1264,8 @@ module mcntrl393 #(
.MCNTRL_TILED_PENDING_CNTR_BITS(MCNTRL_TILED_PENDING_CNTR_BITS), .MCNTRL_TILED_PENDING_CNTR_BITS(MCNTRL_TILED_PENDING_CNTR_BITS),
.MCNTRL_TILED_FRAME_PAGE_RESET (MCNTRL_TILED_FRAME_PAGE_RESET) .MCNTRL_TILED_FRAME_PAGE_RESET (MCNTRL_TILED_FRAME_PAGE_RESET)
) mcntrl_tiled_rw_chn2_i ( ) mcntrl_tiled_rw_chn2_i (
.rst(rst), // input .mrst (mrst), // input
.mclk(mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_tiled_chn2_ad), // input[7:0] .cmd_ad (cmd_tiled_chn2_ad), // input[7:0]
.cmd_stb (cmd_tiled_chn2_stb), // input .cmd_stb (cmd_tiled_chn2_stb), // input
.status_ad (status_tiled_chn2_ad), // output[7:0] .status_ad (status_tiled_chn2_ad), // output[7:0]
...@@ -1316,8 +1320,8 @@ module mcntrl393 #( ...@@ -1316,8 +1320,8 @@ module mcntrl393 #(
.MCNTRL_TILED_PENDING_CNTR_BITS(MCNTRL_TILED_PENDING_CNTR_BITS), .MCNTRL_TILED_PENDING_CNTR_BITS(MCNTRL_TILED_PENDING_CNTR_BITS),
.MCNTRL_TILED_FRAME_PAGE_RESET (MCNTRL_TILED_FRAME_PAGE_RESET) .MCNTRL_TILED_FRAME_PAGE_RESET (MCNTRL_TILED_FRAME_PAGE_RESET)
) mcntrl_tiled_rw_chn4_i ( ) mcntrl_tiled_rw_chn4_i (
.rst(rst), // input .mrst (mrst), // input
.mclk(mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_tiled_chn4_ad), // input[7:0] .cmd_ad (cmd_tiled_chn4_ad), // input[7:0]
.cmd_stb (cmd_tiled_chn4_stb), // input .cmd_stb (cmd_tiled_chn4_stb), // input
.status_ad (status_tiled_chn4_ad), // output[7:0] .status_ad (status_tiled_chn4_ad), // output[7:0]
...@@ -1329,7 +1333,7 @@ module mcntrl393 #( ...@@ -1329,7 +1333,7 @@ module mcntrl393 #(
.frame_finished (), // output .frame_finished (), // output
.line_unfinished (line_unfinished_chn4), // output[15:0] .line_unfinished (line_unfinished_chn4), // output[15:0]
.suspend (suspend_chn4), // input .suspend (suspend_chn4), // input
.frame_number (frame_number_chn4), .frame_number (frame_number_chn4), // output [15:0]
.xfer_want (want_rq4), // output .xfer_want (want_rq4), // output
.xfer_need (need_rq4), // output .xfer_need (need_rq4), // output
.xfer_grant (channel_pgm_en4), // input .xfer_grant (channel_pgm_en4), // input
...@@ -1360,7 +1364,7 @@ module mcntrl393 #( ...@@ -1360,7 +1364,7 @@ module mcntrl393 #(
.MCNTRL_PS_CMD (MCNTRL_PS_CMD), //'h1), .MCNTRL_PS_CMD (MCNTRL_PS_CMD), //'h1),
.MCNTRL_PS_STATUS_CNTRL (MCNTRL_PS_STATUS_CNTRL) //'h2) .MCNTRL_PS_STATUS_CNTRL (MCNTRL_PS_STATUS_CNTRL) //'h2)
) mcntrl_ps_pio_i ( ) mcntrl_ps_pio_i (
.rst (rst), // input .mrst (mrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_ps_pio_ad), // input[7:0] .cmd_ad (cmd_ps_pio_ad), // input[7:0]
...@@ -1467,7 +1471,7 @@ module mcntrl393 #( ...@@ -1467,7 +1471,7 @@ module mcntrl393 #(
.RSEL (RSEL), .RSEL (RSEL),
.WSEL (WSEL) .WSEL (WSEL)
) cmd_encod_linear_rw_i ( ) cmd_encod_linear_rw_i (
.rst (rst), // input .mrst (mrst), // input
.clk (mclk), // input .clk (mclk), // input
.bank_in (lin_rw_bank), // input[2:0] .bank_in (lin_rw_bank), // input[2:0]
.row_in (lin_rw_row), // input[14:0] .row_in (lin_rw_row), // input[14:0]
...@@ -1491,7 +1495,6 @@ module mcntrl393 #( ...@@ -1491,7 +1495,6 @@ module mcntrl393 #(
.MAX_TILE_HEIGHT (MAX_TILE_HEIGHT) .MAX_TILE_HEIGHT (MAX_TILE_HEIGHT)
) cmd_encod_tiled_mux_i ( ) cmd_encod_tiled_mux_i (
.clk (mclk), // input .clk (mclk), // input
.bank2 (tiled_rw_chn2_bank), // input[2:0] .bank2 (tiled_rw_chn2_bank), // input[2:0]
.row2 (tiled_rw_chn2_row), // input[14:0] .row2 (tiled_rw_chn2_row), // input[14:0]
.col2 (tiled_rw_chn2_col), // input[6:0] .col2 (tiled_rw_chn2_col), // input[6:0]
...@@ -1587,7 +1590,7 @@ module mcntrl393 #( ...@@ -1587,7 +1590,7 @@ module mcntrl393 #(
.RSEL (RSEL), .RSEL (RSEL),
.WSEL (WSEL) .WSEL (WSEL)
) cmd_encod_tiled_16_rw_i ( ) cmd_encod_tiled_16_rw_i (
.rst (rst), // input .mrst (mrst), // input
.clk (mclk), // input .clk (mclk), // input
.start_bank (tiled_rw_bank), // input[2:0] .start_bank (tiled_rw_bank), // input[2:0]
.start_row (tiled_rw_row), // input[14:0] .start_row (tiled_rw_row), // input[14:0]
...@@ -1739,7 +1742,10 @@ module mcntrl393 #( ...@@ -1739,7 +1742,10 @@ module mcntrl393 #(
.rst_in (rst_in), // input .rst_in (rst_in), // input
.clk_in (clk_in), // input .clk_in (clk_in), // input
.mclk (mclk), // output .mclk (mclk), // output
.mrst (mrst), // input
.locked (locked), // output
.ref_clk (ref_clk), // output .ref_clk (ref_clk), // output
.idelay_ctrl_reset (idelay_ctrl_reset), // output
.cmd_ad (cmd_mcontr_ad), // input[7:0] .cmd_ad (cmd_mcontr_ad), // input[7:0]
.cmd_stb (cmd_mcontr_stb), // input .cmd_stb (cmd_mcontr_stb), // input
.status_ad (status_mcontr_ad[7:0]), // output[7:0] .status_ad (status_mcontr_ad[7:0]), // output[7:0]
......
...@@ -37,7 +37,7 @@ module mcntrl393_test01#( ...@@ -37,7 +37,7 @@ module mcntrl393_test01#(
parameter MCNTRL_TEST01_STATUS_REG_CHN3_ADDR= 'h3e, // status/readback register for channel 4 parameter MCNTRL_TEST01_STATUS_REG_CHN3_ADDR= 'h3e, // status/readback register for channel 4
parameter MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3f // status/readback register for channel 4 parameter MCNTRL_TEST01_STATUS_REG_CHN4_ADDR= 'h3f // status/readback register for channel 4
)( )(
input rst, input mrst,
input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
// programming interface // programming interface
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
...@@ -163,65 +163,65 @@ module mcntrl393_test01#( ...@@ -163,65 +163,65 @@ module mcntrl393_test01#(
next_page_chn4_r <= set_chn4_mode && cmd_next_page_w; next_page_chn4_r <= set_chn4_mode && cmd_next_page_w;
end end
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) page_chn1 <= 0; if (mrst) page_chn1 <= 0;
else if (frame_start_chn1_r) page_chn1 <= 0; else if (frame_start_chn1_r) page_chn1 <= 0;
else if (page_ready_chn1) page_chn1 <= page_chn1 + 1; else if (page_ready_chn1) page_chn1 <= page_chn1 + 1;
if (rst) page_chn2 <= 0; if (mrst) page_chn2 <= 0;
else if (frame_start_chn2_r) page_chn2 <= 0; else if (frame_start_chn2_r) page_chn2 <= 0;
else if (page_ready_chn2) page_chn2 <= page_chn2 + 1; else if (page_ready_chn2) page_chn2 <= page_chn2 + 1;
if (rst) page_chn3 <= 0; if (mrst) page_chn3 <= 0;
else if (frame_start_chn3_r) page_chn3 <= 0; else if (frame_start_chn3_r) page_chn3 <= 0;
else if (page_ready_chn3) page_chn3 <= page_chn3 + 1; else if (page_ready_chn3) page_chn3 <= page_chn3 + 1;
if (rst) page_chn4 <= 0; if (mrst) page_chn4 <= 0;
else if (frame_start_chn4_r) page_chn4 <= 0; else if (frame_start_chn4_r) page_chn4 <= 0;
else if (page_ready_chn4) page_chn4 <= page_chn4 + 1; else if (page_ready_chn4) page_chn4 <= page_chn4 + 1;
if (rst) suspend_chn1_r <= 0; if (mrst) suspend_chn1_r <= 0;
else if (set_chn1_mode) suspend_chn1_r <= cmd_suspend_w; else if (set_chn1_mode) suspend_chn1_r <= cmd_suspend_w;
if (rst) suspend_chn2_r <= 0; if (mrst) suspend_chn2_r <= 0;
else if (set_chn2_mode) suspend_chn2_r <= cmd_suspend_w; else if (set_chn2_mode) suspend_chn2_r <= cmd_suspend_w;
if (rst) suspend_chn3_r <= 0; if (mrst) suspend_chn3_r <= 0;
else if (set_chn3_mode) suspend_chn3_r <= cmd_suspend_w; else if (set_chn3_mode) suspend_chn3_r <= cmd_suspend_w;
if (rst) suspend_chn4_r <= 0; if (mrst) suspend_chn4_r <= 0;
else if (set_chn4_mode) suspend_chn4_r <= cmd_suspend_w; else if (set_chn4_mode) suspend_chn4_r <= cmd_suspend_w;
if (rst) frame_busy_chn1 <= 0; if (mrst) frame_busy_chn1 <= 0;
else if ( frame_start_chn1_r && !frame_done_chn1) frame_busy_chn1 <= 1; else if ( frame_start_chn1_r && !frame_done_chn1) frame_busy_chn1 <= 1;
else if (!frame_start_chn1_r && frame_done_chn1) frame_busy_chn1 <= 0; else if (!frame_start_chn1_r && frame_done_chn1) frame_busy_chn1 <= 0;
if (rst) frame_busy_chn2 <= 0; if (mrst) frame_busy_chn2 <= 0;
else if ( frame_start_chn2_r && !frame_done_chn2) frame_busy_chn2 <= 1; else if ( frame_start_chn2_r && !frame_done_chn2) frame_busy_chn2 <= 1;
else if (!frame_start_chn2_r && frame_done_chn2) frame_busy_chn2 <= 0; else if (!frame_start_chn2_r && frame_done_chn2) frame_busy_chn2 <= 0;
if (rst) frame_busy_chn3 <= 0; if (mrst) frame_busy_chn3 <= 0;
else if ( frame_start_chn3_r && !frame_done_chn3) frame_busy_chn3 <= 1; else if ( frame_start_chn3_r && !frame_done_chn3) frame_busy_chn3 <= 1;
else if (!frame_start_chn3_r && frame_done_chn3) frame_busy_chn3 <= 0; else if (!frame_start_chn3_r && frame_done_chn3) frame_busy_chn3 <= 0;
if (rst) frame_busy_chn4 <= 0; if (mrst) frame_busy_chn4 <= 0;
else if ( frame_start_chn4_r && !frame_done_chn4) frame_busy_chn4 <= 1; else if ( frame_start_chn4_r && !frame_done_chn4) frame_busy_chn4 <= 1;
else if (!frame_start_chn4_r && frame_done_chn4) frame_busy_chn4 <= 0; else if (!frame_start_chn4_r && frame_done_chn4) frame_busy_chn4 <= 0;
if (rst) frame_finished_chn1 <= 0; if (mrst) frame_finished_chn1 <= 0;
else if ( frame_start_chn1_r && !frame_done_chn1) frame_finished_chn1 <= 0; else if ( frame_start_chn1_r && !frame_done_chn1) frame_finished_chn1 <= 0;
else if (!frame_start_chn1_r && frame_done_chn1) frame_finished_chn1 <= 1; else if (!frame_start_chn1_r && frame_done_chn1) frame_finished_chn1 <= 1;
if (rst) frame_finished_chn2 <= 0; if (mrst) frame_finished_chn2 <= 0;
else if ( frame_start_chn2_r && !frame_done_chn2) frame_finished_chn2 <= 0; else if ( frame_start_chn2_r && !frame_done_chn2) frame_finished_chn2 <= 0;
else if (!frame_start_chn2_r && frame_done_chn2) frame_finished_chn2 <= 1; else if (!frame_start_chn2_r && frame_done_chn2) frame_finished_chn2 <= 1;
if (rst) frame_finished_chn3 <= 0; if (mrst) frame_finished_chn3 <= 0;
else if ( frame_start_chn3_r && !frame_done_chn3) frame_finished_chn3 <= 0; else if ( frame_start_chn3_r && !frame_done_chn3) frame_finished_chn3 <= 0;
else if (!frame_start_chn3_r && frame_done_chn3) frame_finished_chn3 <= 1; else if (!frame_start_chn3_r && frame_done_chn3) frame_finished_chn3 <= 1;
if (rst) frame_finished_chn4 <= 0; if (mrst) frame_finished_chn4 <= 0;
else if ( frame_start_chn4_r && !frame_done_chn4) frame_finished_chn4 <= 0; else if ( frame_start_chn4_r && !frame_done_chn4) frame_finished_chn4 <= 0;
else if (!frame_start_chn4_r && frame_done_chn4) frame_finished_chn4 <= 1; else if (!frame_start_chn4_r && frame_done_chn4) frame_finished_chn4 <= 1;
end end
...@@ -244,8 +244,9 @@ module mcntrl393_test01#( ...@@ -244,8 +244,9 @@ module mcntrl393_test01#(
.ADDR_WIDTH (4), .ADDR_WIDTH (4),
.DATA_WIDTH (8) .DATA_WIDTH (8)
) cmd_deser_mcontr_test01_8bit_i ( ) cmd_deser_mcontr_test01_8bit_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[15:0] .addr (cmd_a), // output[15:0]
...@@ -255,8 +256,9 @@ module mcntrl393_test01#( ...@@ -255,8 +256,9 @@ module mcntrl393_test01#(
status_router4 status_router4_i ( status_router4 status_router4_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.db_in0 (status_chn1_ad), // input[7:0] .db_in0 (status_chn1_ad), // input[7:0]
.rq_in0 (status_chn1_rq), // input .rq_in0 (status_chn1_rq), // input
.start_in0 (status_chn1_start), // output .start_in0 (status_chn1_start), // output
...@@ -279,8 +281,9 @@ module mcntrl393_test01#( ...@@ -279,8 +281,9 @@ module mcntrl393_test01#(
.STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN1_ADDR), .STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN1_ADDR),
.PAYLOAD_BITS(STATUS_PAYLOAD_BITS) .PAYLOAD_BITS(STATUS_PAYLOAD_BITS)
) status_generate_chn1_i ( ) status_generate_chn1_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (set_chn1_status), // input .we (set_chn1_status), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_chn1), // input[25:0] .status (status_chn1), // input[25:0]
...@@ -293,8 +296,9 @@ module mcntrl393_test01#( ...@@ -293,8 +296,9 @@ module mcntrl393_test01#(
.STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN2_ADDR), .STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN2_ADDR),
.PAYLOAD_BITS(STATUS_PAYLOAD_BITS) .PAYLOAD_BITS(STATUS_PAYLOAD_BITS)
) status_generate_chn2_i ( ) status_generate_chn2_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (set_chn2_status), // input .we (set_chn2_status), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_chn2), // input[25:0] .status (status_chn2), // input[25:0]
...@@ -307,8 +311,9 @@ module mcntrl393_test01#( ...@@ -307,8 +311,9 @@ module mcntrl393_test01#(
.STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN3_ADDR), .STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN3_ADDR),
.PAYLOAD_BITS(STATUS_PAYLOAD_BITS) .PAYLOAD_BITS(STATUS_PAYLOAD_BITS)
) status_generate_chn3_i ( ) status_generate_chn3_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (set_chn3_status), // input .we (set_chn3_status), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_chn3), // input[25:0] .status (status_chn3), // input[25:0]
...@@ -321,8 +326,9 @@ module mcntrl393_test01#( ...@@ -321,8 +326,9 @@ module mcntrl393_test01#(
.STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN4_ADDR), .STATUS_REG_ADDR(MCNTRL_TEST01_STATUS_REG_CHN4_ADDR),
.PAYLOAD_BITS(STATUS_PAYLOAD_BITS) .PAYLOAD_BITS(STATUS_PAYLOAD_BITS)
) status_generate_chn4_i ( ) status_generate_chn4_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (set_chn4_status), // input .we (set_chn4_status), // input
.wd (cmd_data[7:0]), // input[7:0] .wd (cmd_data[7:0]), // input[7:0]
.status (status_chn4), // input[25:0] .status (status_chn4), // input[25:0]
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ module mcntrl_ps_pio#( ...@@ -30,7 +30,7 @@ module mcntrl_ps_pio#(
parameter MCNTRL_PS_CMD= 'h1, parameter MCNTRL_PS_CMD= 'h1,
parameter MCNTRL_PS_STATUS_CNTRL= 'h2 parameter MCNTRL_PS_STATUS_CNTRL= 'h2
)( )(
input rst, input mrst,
input mclk, input mclk,
// programming interface // programming interface
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
...@@ -136,21 +136,23 @@ reg page_w_set_negedge; ...@@ -136,21 +136,23 @@ reg page_w_set_negedge;
assign set_status_w = cmd_we && (cmd_a== MCNTRL_PS_STATUS_CNTRL); assign set_status_w = cmd_we && (cmd_a== MCNTRL_PS_STATUS_CNTRL);
assign set_en_rst = cmd_we && (cmd_a== MCNTRL_PS_EN_RST); assign set_en_rst = cmd_we && (cmd_a== MCNTRL_PS_EN_RST);
//PAGE_CNTR_BITS //PAGE_CNTR_BITS
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) pending_pages <= 0; if (mrst) pending_pages <= 0;
else if (chn_rst) pending_pages <= 0; else if (chn_rst) pending_pages <= 0;
else if ( cmd_set && !seq_done) pending_pages <= pending_pages + 1; else if ( cmd_set && !seq_done) pending_pages <= pending_pages + 1;
else if (!cmd_set && seq_done) pending_pages <= pending_pages - 1; else if (!cmd_set && seq_done) pending_pages <= pending_pages - 1;
if (rst) nreset_page_fifo <= 0; if (mrst) nreset_page_fifo <= 0;
else nreset_page_fifo <= cmd_nempty | busy; else nreset_page_fifo <= cmd_nempty | busy;
if (rst) cmd_wait_r <= 0;
if (mrst) cmd_wait_r <= 0;
else if (channel_pgm_en) cmd_wait_r <= cmd_wait; else if (channel_pgm_en) cmd_wait_r <= cmd_wait;
if (rst) en_reset <= 0;
if (mrst) en_reset <= 0;
else if (set_en_rst) en_reset <= cmd_data[1:0]; else if (set_en_rst) en_reset <= cmd_data[1:0];
if (rst) begin if (mrst) begin
want_rq <= 0; want_rq <= 0;
need_rq <= 0; need_rq <= 0;
end else if (chn_rst || channel_pgm_en) begin end else if (chn_rst || channel_pgm_en) begin
...@@ -162,13 +164,12 @@ reg page_w_set_negedge; ...@@ -162,13 +164,12 @@ reg page_w_set_negedge;
end end
if (rst) cmd_set <= 0; if (mrst) cmd_set <= 0;
else if (chn_rst) cmd_set <= 0; else if (chn_rst) cmd_set <= 0;
else cmd_set <= channel_pgm_en; else cmd_set <= channel_pgm_en;
if (rst) cmd_set_d <= 0; if (mrst) cmd_set_d <= 0;
// else cmd_set_d <= {cmd_set_d[0],cmd_set& ~cmd_chn}; // only for channel0 (memory read)
else cmd_set_d <= {cmd_set_d[0],cmd_set & ~cmd_wr}; // only for channel0 (memory read) else cmd_set_d <= {cmd_set_d[0],cmd_set & ~cmd_wr}; // only for channel0 (memory read)
end end
...@@ -180,8 +181,9 @@ reg page_w_set_negedge; ...@@ -180,8 +181,9 @@ reg page_w_set_negedge;
.ADDR_WIDTH (5), .ADDR_WIDTH (5),
.DATA_WIDTH (32) .DATA_WIDTH (32)
) cmd_deser_mcontr_32bit_i ( ) cmd_deser_mcontr_32bit_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[15:0] .addr (cmd_a), // output[15:0]
...@@ -193,8 +195,9 @@ reg page_w_set_negedge; ...@@ -193,8 +195,9 @@ reg page_w_set_negedge;
.STATUS_REG_ADDR (MCNTRL_PS_STATUS_REG_ADDR), .STATUS_REG_ADDR (MCNTRL_PS_STATUS_REG_ADDR),
.PAYLOAD_BITS (2) .PAYLOAD_BITS (2)
) status_generate_i ( ) status_generate_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // 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 (status_data), // input[25:0] .status (status_data), // input[25:0]
...@@ -207,9 +210,9 @@ fifo_same_clock #( ...@@ -207,9 +210,9 @@ fifo_same_clock #(
.DATA_WIDTH(CMD_WIDTH), .DATA_WIDTH(CMD_WIDTH),
.DATA_DEPTH(CMD_FIFO_DEPTH) .DATA_DEPTH(CMD_FIFO_DEPTH)
) cmd_fifo_i ( ) cmd_fifo_i (
.rst (rst), .rst (1'b0),
.clk (mclk), .clk (mclk),
.sync_rst(chn_rst), // synchronously reset fifo; .sync_rst (chn_rst), // synchronously reset fifo;
.we (set_cmd_w), .we (set_cmd_w),
.re (cmd_set), .re (cmd_set),
.data_in (cmd_data[CMD_WIDTH-1:0]), .data_in (cmd_data[CMD_WIDTH-1:0]),
...@@ -266,9 +269,9 @@ fifo_same_clock #( ...@@ -266,9 +269,9 @@ fifo_same_clock #(
.DATA_WIDTH(3), .DATA_WIDTH(3),
.DATA_DEPTH(PAGE_FIFO_DEPTH) .DATA_DEPTH(PAGE_FIFO_DEPTH)
) page_fifo1_i ( ) page_fifo1_i (
.rst (rst), .rst (1'b0),
.clk (mclk), // posedge .clk (mclk), // posedge
.sync_rst (!nreset_page_fifo), // synchronously reset fifo; .sync_rst (mrst || !nreset_page_fifo), // synchronously reset fifo;
.we (channel_pgm_en), .we (channel_pgm_en),
.re (buf_run), .re (buf_run),
.data_in ({cmd_wr,cmd_page}), //page), .data_in ({cmd_wr,cmd_page}), //page),
...@@ -277,8 +280,8 @@ fifo_same_clock #( ...@@ -277,8 +280,8 @@ fifo_same_clock #(
.half_full () .half_full ()
); );
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) page_out_r <= 0; if (mrst) page_out_r <= 0;
else if (buf_run) page_out_r <= page_out; else if (buf_run) page_out_r <= page_out;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -71,13 +71,14 @@ module phy_cmd#( ...@@ -71,13 +71,14 @@ module phy_cmd#(
input clk_in, input clk_in,
input rst_in, input rst_in,
output mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port output mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
input mrst, // @posedge mclk synchronous reset - should not interrupt mclk generation
output ref_clk, // global clock for idelay_ctrl calibration output ref_clk, // global clock for idelay_ctrl calibration
output idelay_ctrl_reset,
// inteface to control I/O delays and mmcm // inteface to control I/O delays and mmcm
input [7:0] dly_data, // delay value (3 LSB - fine delay) input [7:0] dly_data, // delay value (3 LSB - fine delay)
input [6:0] dly_addr, // select which delay to program input [6:0] dly_addr, // select which delay to program
input ld_delay, // load delay data to selected iodelayl (clk_div synchronous) input ld_delay, // load delay data to selected iodelayl (clk_div synchronous)
input set, // clk_div synchronous set all delays from previously loaded values input set, // clk_div synchronous set all delays from previously loaded values
// output locked,
output locked_mmcm, output locked_mmcm,
output locked_pll, output locked_pll,
output dly_ready, output dly_ready,
...@@ -93,7 +94,6 @@ module phy_cmd#( ...@@ -93,7 +94,6 @@ module phy_cmd#(
output ps_rdy, output ps_rdy,
output [PHASE_WIDTH-1:0] ps_out, output [PHASE_WIDTH-1:0] ps_out,
// command port // command port
// input [35:0] phy_cmd,
input [31:0] phy_cmd_word, input [31:0] phy_cmd_word,
output phy_cmd_nop, output phy_cmd_nop,
output phy_cmd_add_pause, // one pause cycle (for 8-bursts) output phy_cmd_add_pause, // one pause cycle (for 8-bursts)
...@@ -101,14 +101,12 @@ module phy_cmd#( ...@@ -101,14 +101,12 @@ module phy_cmd#(
output [CMD_PAUSE_BITS-1:0] pause_len, output [CMD_PAUSE_BITS-1:0] pause_len,
output sequence_done, output sequence_done,
// external memory buffer (cs- channel select, high addresses- page addresses are decoded externally) // external memory buffer (cs- channel select, high addresses- page addresses are decoded externally)
// output [ 6:0] buf_addr,
output [63:0] buf_wdata, // data to be written to the buffer (from DDR3), valid @ negedge mclk output [63:0] buf_wdata, // data to be written to the buffer (from DDR3), valid @ negedge mclk
input [63:0] buf_rdata, // data read from the buffer (to DDR3) input [63:0] buf_rdata, // data read from the buffer (to DDR3)
output buf_wr, // write buffer (next cycle!) output buf_wr, // write buffer (next cycle!)
output buf_rd, // read buffer (ready next cycle) output buf_rd, // read buffer (ready next cycle)
output buf_rst, // reset external buffer address to page start output buf_rst, // reset external buffer address to page start
// extras // extras
// input cmda_tri, // tristate command and address lines // not likely to be used
input cmda_en, // tristate command and address lines // not likely to be used input cmda_en, // tristate command and address lines // not likely to be used
input ddr_rst, // generate reset to DDR3 memory (active high) input ddr_rst, // generate reset to DDR3 memory (active high)
input dci_rst, // active high - reset DCI circuitry input dci_rst, // active high - reset DCI circuitry
...@@ -157,7 +155,6 @@ module phy_cmd#( ...@@ -157,7 +155,6 @@ module phy_cmd#(
wire phy_buf_rd_cur; // connect to external buffer (but only if not paused) wire phy_buf_rd_cur; // connect to external buffer (but only if not paused)
wire phy_buf_rst_cur; wire phy_buf_rst_cur;
// wire clk;
wire clk_div; wire clk_div;
reg [7:0] dly_data_r; // delay value (3 LSB - fine delay) reg [7:0] dly_data_r; // delay value (3 LSB - fine delay)
...@@ -176,10 +173,8 @@ module phy_cmd#( ...@@ -176,10 +173,8 @@ module phy_cmd#(
wire phy_dci_dis_dqs; wire phy_dci_dis_dqs;
reg dqs_tri_prev, dq_tri_prev; reg dqs_tri_prev, dq_tri_prev;
// wire phy_locked;
wire phy_ps_rdy; wire phy_ps_rdy;
wire [PHASE_WIDTH-1:0] phy_ps_out; wire [PHASE_WIDTH-1:0] phy_ps_out;
// reg locked_r1,locked_r2;
reg ps_rdy_r1,ps_rdy_r2; reg ps_rdy_r1,ps_rdy_r2;
reg locked_mmcm_r1,locked_mmcm_r2; reg locked_mmcm_r1,locked_mmcm_r2;
reg locked_pll_r1, locked_pll_r2; reg locked_pll_r1, locked_pll_r2;
...@@ -195,16 +190,8 @@ module phy_cmd#( ...@@ -195,16 +190,8 @@ module phy_cmd#(
reg [ 2:0] phy_bank_prev; reg [ 2:0] phy_bank_prev;
wire [ADDRESS_NUMBER-1:0] phy_addr_calm; wire [ADDRESS_NUMBER-1:0] phy_addr_calm;
wire [ 2:0] phy_bank_calm; wire [ 2:0] phy_bank_calm;
// reg [ 8:0] extra_prev;
reg [ 9:0] extra_prev; reg [ 9:0] extra_prev;
// assign phy_locked= phy_locked_mmcm && phy_locked_pll; // no dci and dly here
// output [63:0] buf_wdata, // data to be written to the buffer (from DDR3)
// SuppressWarnings VEditor
// (* keep = "true" *) wire phy_spare;
assign { assign {
phy_addr_in, phy_addr_in,
phy_bank_in, phy_bank_in,
...@@ -216,7 +203,6 @@ module phy_cmd#( ...@@ -216,7 +203,6 @@ module phy_cmd#(
phy_dqs_en_in, //phy_dqs_tri_in, // tristate DQS lines (internal timing sequencer for 0->1 and 1->0) phy_dqs_en_in, //phy_dqs_tri_in, // tristate DQS lines (internal timing sequencer for 0->1 and 1->0)
phy_dqs_toggle_en, //enable toggle DQS according to the pattern phy_dqs_toggle_en, //enable toggle DQS according to the pattern
phy_dci_en_in, //phy_dci_in, // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0) phy_dci_en_in, //phy_dci_in, // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0)
// phy_buf_addr, // connect to external buffer (is it needed? maybe just autoincrement?)
phy_buf_wr, // connect to external buffer (but only if not paused) phy_buf_wr, // connect to external buffer (but only if not paused)
phy_buf_rd, // connect to external buffer (but only if not paused) phy_buf_rd, // connect to external buffer (but only if not paused)
phy_cmd_add_pause, // add nop to current command phy_cmd_add_pause, // add nop to current command
...@@ -260,13 +246,10 @@ module phy_cmd#( ...@@ -260,13 +246,10 @@ module phy_cmd#(
assign phy_addr_calm= (phy_cmd_nop || add_pause) ? phy_addr_prev : phy_addr_in; assign phy_addr_calm= (phy_cmd_nop || add_pause) ? phy_addr_prev : phy_addr_in;
assign phy_bank_calm= (phy_cmd_nop || add_pause) ? phy_bank_prev : phy_bank_in; assign phy_bank_calm= (phy_cmd_nop || add_pause) ? phy_bank_prev : phy_bank_in;
// assign buf_addr = phy_buf_addr;
assign buf_wr = phy_buf_wr_cur; assign buf_wr = phy_buf_wr_cur;
assign buf_rd = phy_buf_rd_cur; assign buf_rd = phy_buf_rd_cur;
assign buf_rst= phy_buf_rst_cur; assign buf_rst= phy_buf_rst_cur;
// assign phy_addr= {phy_addr_in,phy_addr_in}; // also provides pause length when the command is NOP
// assign phy_bank= {phy_bank_in,phy_bank_in};
assign phy_addr= {phy_addr_calm,phy_addr_calm}; // also provides pause length when the command is NOP assign phy_addr= {phy_addr_calm,phy_addr_calm}; // also provides pause length when the command is NOP
assign phy_bank= {phy_bank_calm,phy_bank_calm}; assign phy_bank= {phy_bank_calm,phy_bank_calm};
assign phy_rcw= {phy_sel_cur?phy_rcw_in:3'h7, phy_sel_cur?3'h7:phy_rcw_in}; // {ras,cas,we} assign phy_rcw= {phy_sel_cur?phy_rcw_in:3'h7, phy_sel_cur?3'h7:phy_rcw_in}; // {ras,cas,we}
...@@ -282,7 +265,6 @@ module phy_cmd#( ...@@ -282,7 +265,6 @@ module phy_cmd#(
assign phy_dci_dis_dq = phy_dci_in; // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0) assign phy_dci_dis_dq = phy_dci_in; // DCI disable, both DQ and DQS lines (internal logic and timing sequencer for 0->1 and 1->0)
assign phy_dci_dis_dqs = phy_dci_in || phy_odt_cur; // In write leveling mode phy_dci_in = 0, phy_odt_cur=1 - use DCI on DQ only, no DQS assign phy_dci_dis_dqs = phy_dci_in || phy_odt_cur; // In write leveling mode phy_dci_in = 0, phy_odt_cur=1 - use DCI on DQ only, no DQS
// assign locked = locked_r2;
assign ps_rdy = ps_rdy_r2; assign ps_rdy = ps_rdy_r2;
assign ps_out = ps_out_r2; assign ps_out = ps_out_r2;
...@@ -300,8 +282,8 @@ module phy_cmd#( ...@@ -300,8 +282,8 @@ module phy_cmd#(
dq_tri_prev <= phy_dq_tri_in; dq_tri_prev <= phy_dq_tri_in;
end end
always @ (posedge mclk or posedge rst_in) begin always @ (posedge mclk) begin
if (rst_in) begin if (mrst) begin
phy_addr_prev <= 0; phy_addr_prev <= 0;
phy_bank_prev <= 0; phy_bank_prev <= 0;
extra_prev <= 0; extra_prev <= 0;
...@@ -326,8 +308,11 @@ module phy_cmd#( ...@@ -326,8 +308,11 @@ module phy_cmd#(
end end
// cross clock boundary posedge mclk -> posedge clk_div (mclk is later than clk_div) // cross clock boundary posedge mclk -> posedge clk_div (mclk is later than clk_div)
always @ (posedge clk_div or posedge rst_in) begin reg rst_clk_div = 1;
if (rst_in) begin always @ (posedge clk_div) rst_clk_div <= mrst;
always @ (posedge clk_div) begin
if (rst_clk_div) begin
dly_data_r <= 0; dly_data_r <= 0;
dly_addr_r <= 0; dly_addr_r <= 0;
ld_delay_r <= 0; ld_delay_r <= 0;
...@@ -343,7 +328,6 @@ module phy_cmd#( ...@@ -343,7 +328,6 @@ module phy_cmd#(
// cross clock boundary posedge posedge clk_div->negedge clk_div -> posedge mclk (mclk is later than clk_div) // cross clock boundary posedge posedge clk_div->negedge clk_div -> posedge mclk (mclk is later than clk_div)
always @ (negedge clk_div) begin always @ (negedge clk_div) begin
// locked_r1 <= phy_locked;
ps_rdy_r1 <= phy_ps_rdy; ps_rdy_r1 <= phy_ps_rdy;
ps_out_r1 <= phy_ps_out; ps_out_r1 <= phy_ps_out;
...@@ -354,7 +338,6 @@ module phy_cmd#( ...@@ -354,7 +338,6 @@ module phy_cmd#(
end end
always @ (posedge mclk) begin always @ (posedge mclk) begin
// locked_r2 <= locked_r1;
ps_rdy_r2 <= ps_rdy_r1; ps_rdy_r2 <= ps_rdy_r1;
ps_out_r2 <= ps_out_r1; ps_out_r2 <= ps_out_r1;
...@@ -423,11 +406,12 @@ module phy_cmd#( ...@@ -423,11 +406,12 @@ module phy_cmd#(
.dqsu (DQSU), // inout .dqsu (DQSU), // inout
.ndqsu (NDQSU), // inout .ndqsu (NDQSU), // inout
.clk_in (clk_in), // input .clk_in (clk_in), // input
// .clk (clk), // output
.clk (), // output .clk (), // output
.clk_div (clk_div), // output .clk_div (clk_div), // output
.mclk (mclk), // output .mclk (mclk), // output
.mrst (mrst), // input
.ref_clk (ref_clk), // output .ref_clk (ref_clk), // output
.idelay_ctrl_reset (idelay_ctrl_reset), // output
.rst_in (rst_in), // input .rst_in (rst_in), // input
.ddr_rst (ddr_rst), // input .ddr_rst (ddr_rst), // input
...@@ -454,12 +438,11 @@ module phy_cmd#( ...@@ -454,12 +438,11 @@ module phy_cmd#(
.dly_addr (dly_addr_r), // input[6:0] .dly_addr (dly_addr_r), // input[6:0]
.ld_delay (ld_delay_r), // input .ld_delay (ld_delay_r), // input
.set (set_r), // input .set (set_r), // input
// .locked (phy_locked), // output
.locked_mmcm (phy_locked_mmcm), // output .locked_mmcm (phy_locked_mmcm), // output
.locked_pll (phy_locked_pll), // output .locked_pll (phy_locked_pll), // output
.dly_ready (phy_dly_ready), // output .dly_ready (phy_dly_ready), // output
.dci_ready (phy_dci_ready), // output .dci_ready (phy_dci_ready), // output
.tmp_debug (tmp_debug[7:0]), .tmp_debug (tmp_debug[7:0]), // output[7:0]
.ps_rdy (phy_ps_rdy), // output .ps_rdy (phy_ps_rdy), // output
.ps_out (phy_ps_out) // output[7:0] .ps_out (phy_ps_out) // output[7:0]
); );
......
...@@ -75,8 +75,10 @@ module phy_top #( ...@@ -75,8 +75,10 @@ module phy_top #(
output clk, // free-running system clock, same frequency as iclk (shared for R/W), BUFR output output clk, // free-running system clock, same frequency as iclk (shared for R/W), BUFR output
output clk_div, // free-running half clk frequency, front aligned to clk (shared for R/W), BUFR output output clk_div, // free-running half clk frequency, front aligned to clk (shared for R/W), BUFR output
output mclk, // same as clk_div, through separate BUFG and static phase adjust output mclk, // same as clk_div, through separate BUFG and static phase adjust
input mrst, // @posedge mclk synchronous reset - should not interrupt mclk generation
output ref_clk, // global clock for idelay_ctrl calibration output ref_clk, // global clock for idelay_ctrl calibration
input rst_in, // reset delays/serdes output idelay_ctrl_reset,
input rst_in, // reset delays/serdes - global reset?
input ddr_rst, // active high - generate NRST to memory input ddr_rst, // active high - generate NRST to memory
input dci_rst, // active high - reset DCI circuitry input dci_rst, // active high - reset DCI circuitry
input dly_rst, // active high - delay calibration circuitry input dly_rst, // active high - delay calibration circuitry
...@@ -116,9 +118,15 @@ module phy_top #( ...@@ -116,9 +118,15 @@ module phy_top #(
output ps_rdy, output ps_rdy,
output [PHASE_WIDTH-1:0] ps_out output [PHASE_WIDTH-1:0] ps_out
); );
reg rst= 1'b1; reg rst= 1'b1;
always @(negedge clk_div or posedge rst_in) begin // always @(negedge clk_div or posedge rst_in) begin // Why is it @ negedge clk_div?
if (rst_in) rst <= 1'b1; // if (rst_in) rst <= 1'b1;
// else rst <= 1'b0;
// end
always @(negedge clk_div) begin // Why is it @ negedge clk_div?
if (mrst) rst <= 1'b1;
else rst <= 1'b0; else rst <= 1'b0;
end end
...@@ -136,6 +144,7 @@ module phy_top #( ...@@ -136,6 +144,7 @@ module phy_top #(
reg dbg1=0; reg dbg1=0;
reg dbg2=0; reg dbg2=0;
/*
always @ (posedge rst_in or posedge mclk) begin always @ (posedge rst_in or posedge mclk) begin
if (rst_in) dbg1 <= 0; if (rst_in) dbg1 <= 0;
else dbg1 <= ~dbg1; else dbg1 <= ~dbg1;
...@@ -145,6 +154,16 @@ module phy_top #( ...@@ -145,6 +154,16 @@ module phy_top #(
if (rst_in) dbg2 <= 0; if (rst_in) dbg2 <= 0;
else dbg2 <= ~dbg2; else dbg2 <= ~dbg2;
end end
*/
always @ (posedge mclk) begin
if (mrst) dbg1 <= 0;
else dbg1 <= ~dbg1;
end
always @ (posedge clk_div) begin
if (mrst) dbg2 <= 0;
else dbg2 <= ~dbg2;
end
assign tmp_debug ={ assign tmp_debug ={
...@@ -153,7 +172,7 @@ module phy_top #( ...@@ -153,7 +172,7 @@ module phy_top #(
clkin_stopped_mmcm, clkin_stopped_mmcm,
clkfb_stopped_mmcm, clkfb_stopped_mmcm,
ddr_rst, ddr_rst,
rst_in, mrst, // rst_in, rst_in - is it global clock?
dci_rst, dci_rst,
dly_rst dly_rst
}; };
...@@ -388,11 +407,12 @@ BUFG mclk_i (.O(mclk),.I(mclk_pre) ); ...@@ -388,11 +407,12 @@ BUFG mclk_i (.O(mclk),.I(mclk_pre) );
.locked(locked_pll) // output .locked(locked_pll) // output
); );
// Does it need to be re-calibrated periodically - yes when temperature changes, same as dci_reset // Does it need to be re-calibrated periodically - yes when temperature changes, same as dci_reset
assign idelay_ctrl_reset = rst || dly_rst;
idelay_ctrl# ( idelay_ctrl# (
.IODELAY_GRP("IODELAY_MEMORY") .IODELAY_GRP("IODELAY_MEMORY")
) idelay_ctrl_i ( ) idelay_ctrl_i (
.refclk(ref_clk), .refclk(ref_clk),
.rst(rst || dly_rst), .rst(idelay_ctrl_reset), // route it to the top
.rdy(dly_ready) .rdy(dly_ready)
); );
dci_reset dci_reset_i ( dci_reset dci_reset_i (
......
...@@ -24,7 +24,7 @@ module scheduler16 #( ...@@ -24,7 +24,7 @@ module scheduler16 #(
parameter width=16, // counter number of bits parameter width=16, // counter number of bits
parameter n_chn=16 // number of channels parameter n_chn=16 // number of channels
)( )(
input rst, input mrst,
input clk, input clk,
input [n_chn-1:0] chn_en, // channel enable mask input [n_chn-1:0] chn_en, // channel enable mask
input [n_chn-1:0] want_rq, // both want_rq and need_rq should go inactive after being granted input [n_chn-1:0] want_rq, // both want_rq and need_rq should go inactive after being granted
...@@ -60,8 +60,8 @@ module scheduler16 #( ...@@ -60,8 +60,8 @@ module scheduler16 #(
generate generate
genvar i; genvar i;
for (i=0;i<n_chn;i=i+1) begin: pri_reg_block for (i=0;i<n_chn;i=i+1) begin: pri_reg_block
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) pri_reg[width*i +: width] <= 0; if (mrst) pri_reg[width*i +: width] <= 0;
else if (pgm_en && (pgm_addr==i)) pri_reg[width*i +: width] <= pgm_data; else if (pgm_en && (pgm_addr==i)) pri_reg[width*i +: width] <= pgm_data;
end end
end end
...@@ -81,8 +81,8 @@ module scheduler16 #( ...@@ -81,8 +81,8 @@ module scheduler16 #(
assign next_want_conf= (want_conf & want_rq & chn_en) | want_set; assign next_want_conf= (want_conf & want_rq & chn_en) | want_set;
assign next_need_conf= (need_conf & need_rq & chn_en) | need_set; assign next_need_conf= (need_conf & need_rq & chn_en) | need_set;
assign need_want_conf_w=need_some? next_need_conf: next_want_conf; assign need_want_conf_w=need_some? next_need_conf: next_want_conf;
always @(posedge rst or posedge clk) begin always @(posedge clk) begin
if (rst) begin if (mrst) begin
want_conf <= 0; want_conf <= 0;
need_conf <= 0; need_conf <= 0;
end else begin end else begin
...@@ -126,8 +126,8 @@ module scheduler16 #( ...@@ -126,8 +126,8 @@ module scheduler16 #(
.index (index[3:0]), .index (index[3:0]),
.valid (index_valid), .valid (index_valid),
.need_out (need)); .need_out (need));
always @(posedge rst or posedge clk) begin always @(posedge clk) begin
if (rst) begin if (mrst) begin
grant_r <=0; grant_r <=0;
grant_sent <=0; grant_sent <=0;
grant_chn_r <=0; grant_chn_r <=0;
......
...@@ -38,7 +38,8 @@ module pxd_single#( ...@@ -38,7 +38,8 @@ module pxd_single#(
output pxd_in, // data output (@posedge ipclk?) output pxd_in, // data output (@posedge ipclk?)
input ipclk, // restored clock from the sensor, phase-shifted input ipclk, // restored clock from the sensor, phase-shifted
input ipclk2x, // restored clock from the sensor, phase-shifted, twice frequency input ipclk2x, // restored clock from the sensor, phase-shifted, twice frequency
input rst, // reset input mrst, // reset @ posxedge mclk
input irst, // reset @ posxedge iclk
input mclk, // clock for setting delay values input mclk, // clock for setting delay values
input [7:0] dly_data, // delay value (3 LSB - fine delay) - @posedge mclk input [7:0] dly_data, // delay value (3 LSB - fine delay) - @posedge mclk
input set_idelay, // mclk synchronous load idelay value input set_idelay, // mclk synchronous load idelay value
...@@ -52,8 +53,8 @@ module pxd_single#( ...@@ -52,8 +53,8 @@ module pxd_single#(
assign pxd_in=pxd_r; assign pxd_in=pxd_r;
assign pxd_async = pxd_iobuf; assign pxd_async = pxd_iobuf;
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) pxd_r <= 0; if (mrst) pxd_r <= 0;
else pxd_r <= quadrant[1]?(quadrant[0]? dout[3]: dout[2]) : (quadrant[0]? dout[1]: dout[0]); else pxd_r <= quadrant[1]?(quadrant[0]? dout[3]: dout[2]) : (quadrant[0]? dout[1]: dout[0]);
end end
...@@ -94,7 +95,7 @@ module pxd_single#( ...@@ -94,7 +95,7 @@ module pxd_single#(
.HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE) .HIGH_PERFORMANCE_MODE (HIGH_PERFORMANCE_MODE)
) pxd_dly_i( ) pxd_dly_i(
.clk (mclk), .clk (mclk),
.rst (rst), .rst (mrst),
.set (set_idelay), .set (set_idelay),
.ld (ld_idelay), .ld (ld_idelay),
.delay (dly_data[7:3]), .delay (dly_data[7:3]),
...@@ -109,7 +110,7 @@ module pxd_single#( ...@@ -109,7 +110,7 @@ module pxd_single#(
.oclk(ipclk2x), // system clock, phase should allow iclk-to-oclk jitter with setup/hold margin .oclk(ipclk2x), // system clock, phase should allow iclk-to-oclk jitter with setup/hold margin
.oclk_div(ipclk), // oclk divided by 2, front aligned .oclk_div(ipclk), // oclk divided by 2, front aligned
.inv_clk_div(1'b0), // invert oclk_div (this clock is shared between iserdes and oserdes. Works only in MEMORY_DDR3 mode? .inv_clk_div(1'b0), // invert oclk_div (this clock is shared between iserdes and oserdes. Works only in MEMORY_DDR3 mode?
.rst(rst), // reset .rst(irst), // reset
.d_direct(1'b0), // direct input from IOB, normally not used, controlled by IOBDELAY parameter (set to "NONE") .d_direct(1'b0), // direct input from IOB, normally not used, controlled by IOBDELAY parameter (set to "NONE")
.ddly(pxd_delayed), // serial input from idelay .ddly(pxd_delayed), // serial input from idelay
.dout(dout[3:0]) // parallel data out .dout(dout[3:0]) // parallel data out
......
...@@ -40,7 +40,7 @@ module sens_gamma #( ...@@ -40,7 +40,7 @@ module sens_gamma #(
parameter SENS_GAMMA_MODE_REPET = 4, parameter SENS_GAMMA_MODE_REPET = 4,
parameter SENS_GAMMA_MODE_TRIG = 5 parameter SENS_GAMMA_MODE_TRIG = 5
) ( ) (
input rst, // input rst,
input pclk, // global clock input, pixel rate (96MHz for MT9P006) input pclk, // global clock input, pixel rate (96MHz for MT9P006)
//input en, // @(posedge pclk) // Enable. Should go active before or with the first hact going active. //input en, // @(posedge pclk) // Enable. Should go active before or with the first hact going active.
// when low will also reset MSB of addresses - buffer page for ping-pong access. // when low will also reset MSB of addresses - buffer page for ping-pong access.
...@@ -52,6 +52,9 @@ module sens_gamma #( ...@@ -52,6 +52,9 @@ module sens_gamma #(
// 3 (optional) - after frame is over (before the first hact of the next one) // 3 (optional) - after frame is over (before the first hact of the next one)
// turn "en" off. If needed to restart - go to step 1 to keep buffer pages in sync. // turn "en" off. If needed to restart - go to step 1 to keep buffer pages in sync.
input mrst, // @mclk sync reset
input prst, // @mclk sync reset
input [15:0] pxd_in, // @(posedge pclk) input [15:0] pxd_in, // @(posedge pclk)
input hact_in, input hact_in,
input sof_in, // start of frame, single pclk, input input sof_in, // start of frame, single pclk, input
...@@ -183,40 +186,40 @@ module sens_gamma #( ...@@ -183,40 +186,40 @@ module sens_gamma #(
assign sof_masked= sof_in && (pend_trig || repet_mode) && en_input; assign sof_masked= sof_in && (pend_trig || repet_mode) && en_input;
assign trig = trig_in || trig_soft; assign trig = trig_in || trig_soft;
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) tdata <= 0; if (mrst) tdata <= 0;
else if (set_taddr_w) tdata <= cmd_data[17:0]; else if (set_taddr_w) tdata <= cmd_data[17:0];
if (rst) set_tdata_r <= 0; if (mrst) set_tdata_r <= 0;
else set_tdata_r <= set_tdata_w; else set_tdata_r <= set_tdata_w;
if (rst) taddr <= 0; if (mrst) taddr <= 0;
else if (set_taddr_w) taddr <= cmd_data[12:0]; else if (set_taddr_w) taddr <= cmd_data[12:0];
else if (set_tdata_r) taddr <= taddr + 1; else if (set_tdata_r) taddr <= taddr + 1;
if (rst) mode_mclk <= 0; if (mrst) mode_mclk <= 0;
else if (set_ctrl_w) mode_mclk <= cmd_data[SENS_GAMMA_MODE_WIDTH-1:0]; else if (set_ctrl_w) mode_mclk <= cmd_data[SENS_GAMMA_MODE_WIDTH-1:0];
if (rst) set_tdata_ram <=0; if (mrst) set_tdata_ram <=0;
else set_tdata_ram <= {4{set_tdata_w}} & else set_tdata_ram <= {4{set_tdata_w}} &
{ taddr[12] & taddr[11], { taddr[12] & taddr[11],
taddr[12] & ~taddr[11], taddr[12] & ~taddr[11],
~taddr[12] & taddr[11], ~taddr[12] & taddr[11],
~taddr[12] & ~taddr[11]}; ~taddr[12] & ~taddr[11]};
if (rst) height0_m1 <= 0; if (mrst) height0_m1 <= 0;
else if (set_height01_w) height0_m1 <= cmd_data[15:0]; else if (set_height01_w) height0_m1 <= cmd_data[15:0];
if (rst) height1_m1 <= 0; if (mrst) height1_m1 <= 0;
else if (set_height01_w) height1_m1 <= cmd_data[31:16]; else if (set_height01_w) height1_m1 <= cmd_data[31:16];
if (rst) height2_m1 <= 0; if (mrst) height2_m1 <= 0;
else if (set_height2_w) height2_m1 <= cmd_data[15:0]; else if (set_height2_w) height2_m1 <= cmd_data[15:0];
end end
always @ (posedge rst or posedge pclk) begin always @ (posedge pclk) begin
if (rst) begin if (prst) begin
mode <= 0; mode <= 0;
hact_d[4:0] <= 0; hact_d[4:0] <= 0;
bayer_nset <= 0; bayer_nset <= 0;
...@@ -277,8 +280,9 @@ module sens_gamma #( ...@@ -277,8 +280,9 @@ module sens_gamma #(
.ADDR_WIDTH (2), .ADDR_WIDTH (2),
.DATA_WIDTH (32) .DATA_WIDTH (32)
) cmd_deser_sens_io_i ( ) cmd_deser_sens_io_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[15:0] .addr (cmd_a), // output[15:0]
...@@ -290,7 +294,7 @@ module sens_gamma #( ...@@ -290,7 +294,7 @@ module sens_gamma #(
.WIDTH(8) .WIDTH(8)
) dly_16_pxd_i ( ) dly_16_pxd_i (
.clk (pclk), // input .clk (pclk), // input
.rst (rst), // input .rst (prst), // input
.dly (3), // input[3:0] .dly (3), // input[3:0]
.din (pxd_in[7:0]), // input[0:0] .din (pxd_in[7:0]), // input[0:0]
.dout(pxd_in_d3) // output[0:0] .dout(pxd_in_d3) // output[0:0]
...@@ -300,13 +304,13 @@ module sens_gamma #( ...@@ -300,13 +304,13 @@ module sens_gamma #(
.WIDTH(2) .WIDTH(2)
) dly_16_sof_eof_i ( ) dly_16_sof_eof_i (
.clk (pclk), // input .clk (pclk), // input
.rst (rst), // input .rst (prst), // input
.dly (4), // input[3:0] .dly (4), // input[3:0]
.din ({eof_in, sof_masked}), // input[0:0] .din ({eof_in, sof_masked}), // input[0:0]
.dout({eof_out,sof_out}) // output[0:0] .dout({eof_out,sof_out}) // output[0:0]
); );
pulse_cross_clock trig_soft_i ( pulse_cross_clock trig_soft_i (
.rst (rst), .rst (mrst),
.src_clk (mclk), .src_clk (mclk),
.dst_clk (pclk), .dst_clk (pclk),
.in_pulse (cmd_data[SENS_GAMMA_MODE_TRIG] && set_ctrl_w), .in_pulse (cmd_data[SENS_GAMMA_MODE_TRIG] && set_ctrl_w),
......
...@@ -27,7 +27,9 @@ module sens_histogram #( ...@@ -27,7 +27,9 @@ module sens_histogram #(
parameter HISTOGRAM_LEFT_TOP = 'h0, parameter HISTOGRAM_LEFT_TOP = 'h0,
parameter HISTOGRAM_WIDTH_HEIGHT = 'h1 // 1.. 2^16, 0 - use HACT parameter HISTOGRAM_WIDTH_HEIGHT = 'h1 // 1.. 2^16, 0 - use HACT
)( )(
input rst, // input rst,
input mrst, // @posedge mclk, sync reset
input prst, // @posedge pclk, sync reset
input pclk, // global clock input, pixel rate (96MHz for MT9P006) input pclk, // global clock input, pixel rate (96MHz for MT9P006)
input pclk2x, input pclk2x,
input sof, input sof,
...@@ -263,8 +265,9 @@ module sens_histogram #( ...@@ -263,8 +265,9 @@ module sens_histogram #(
.ADDR2 (0), .ADDR2 (0),
.ADDR_MASK2 (0) .ADDR_MASK2 (0)
) cmd_deser_sens_histogram_i ( ) cmd_deser_sens_histogram_i (
.rst (rst), // input .rst (1'b0), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (pio_addr), // output[15:0] .addr (pio_addr), // output[15:0]
...@@ -273,7 +276,7 @@ module sens_histogram #( ...@@ -273,7 +276,7 @@ module sens_histogram #(
); );
pulse_cross_clock pulse_cross_clock_lt_i ( pulse_cross_clock pulse_cross_clock_lt_i (
.rst (rst), // input .rst (mrst), // input
.src_clk (mclk), // input .src_clk (mclk), // input
.dst_clk (pclk), // input .dst_clk (pclk), // input
.in_pulse (set_left_top_w), // input .in_pulse (set_left_top_w), // input
...@@ -282,7 +285,7 @@ module sens_histogram #( ...@@ -282,7 +285,7 @@ module sens_histogram #(
); );
pulse_cross_clock pulse_cross_clock_wh_i ( pulse_cross_clock pulse_cross_clock_wh_i (
.rst (rst), // input .rst (mrst), // input
.src_clk (mclk), // input .src_clk (mclk), // input
.dst_clk (pclk), // input .dst_clk (pclk), // input
.in_pulse (set_width_height_w), // input .in_pulse (set_width_height_w), // input
...@@ -291,7 +294,7 @@ module sens_histogram #( ...@@ -291,7 +294,7 @@ module sens_histogram #(
); );
pulse_cross_clock pulse_cross_clock_hist_done_i ( pulse_cross_clock pulse_cross_clock_hist_done_i (
.rst (rst), // input .rst (prst), // input
.src_clk (pclk), // input .src_clk (pclk), // input
.dst_clk (mclk), // input .dst_clk (mclk), // input
.in_pulse (hist_done), // input .in_pulse (hist_done), // input
...@@ -300,7 +303,7 @@ module sens_histogram #( ...@@ -300,7 +303,7 @@ module sens_histogram #(
); );
pulse_cross_clock pulse_cross_clock_hist_xfer_done_i ( pulse_cross_clock pulse_cross_clock_hist_xfer_done_i (
.rst (rst), // input .rst (mrst), // input
.src_clk (mclk), // input .src_clk (mclk), // input
.dst_clk (pclk), // input .dst_clk (pclk), // input
.in_pulse (hist_xfer_done_mclk), // input .in_pulse (hist_xfer_done_mclk), // input
......
This diff is collapsed.
...@@ -33,9 +33,11 @@ module sens_sync#( ...@@ -33,9 +33,11 @@ module sens_sync#(
parameter SENS_SYNC_MINPER = 130 // minimal frame period (in pclk/mclk?) parameter SENS_SYNC_MINPER = 130 // minimal frame period (in pclk/mclk?)
)( )(
input rst, // global reset // input rst, // global reset
input pclk, // global clock input, pixel rate (96MHz for MT9P006) input pclk, // global clock input, pixel rate (96MHz for MT9P006)
input mclk, // global system clock, synchronizes commands input mclk, // global system clock, synchronizes commands
input mrst, // @mclk sync reset
input prst, // @mclk sync reset
input en, // @pclk enable channel (0 resets counters) input en, // @pclk enable channel (0 resets counters)
input sof_in, // @pclk start of frame input, single-cycle input sof_in, // @pclk start of frame input, single-cycle
input eof_in, // @pclk end of frame input, single-cycle (to limit sof_late input eof_in, // @pclk end of frame input, single-cycle (to limit sof_late
...@@ -144,8 +146,9 @@ module sens_sync#( ...@@ -144,8 +146,9 @@ module sens_sync#(
.ADDR2 (0), .ADDR2 (0),
.ADDR_MASK2 (0) .ADDR_MASK2 (0)
) cmd_deser_sens_sync_i ( ) cmd_deser_sens_sync_i (
.rst (rst), // input .rst (1'b0), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (cmd_a), // output[15:0] .addr (cmd_a), // output[15:0]
...@@ -155,7 +158,7 @@ module sens_sync#( ...@@ -155,7 +158,7 @@ module sens_sync#(
// mclk -> pclk // mclk -> pclk
pulse_cross_clock pulse_cross_clock_set_data_pclk_i ( pulse_cross_clock pulse_cross_clock_set_data_pclk_i (
.rst (rst), // input .rst (mrst), // input
.src_clk (mclk), // input .src_clk (mclk), // input
.dst_clk (pclk), // input .dst_clk (pclk), // input
.in_pulse (set_data_mclk), // input .in_pulse (set_data_mclk), // input
...@@ -164,7 +167,7 @@ module sens_sync#( ...@@ -164,7 +167,7 @@ module sens_sync#(
); );
pulse_cross_clock pulse_cross_clock_trig_in_pclk_i ( pulse_cross_clock pulse_cross_clock_trig_in_pclk_i (
.rst (rst), // input .rst (mrst), // input
.src_clk (mclk), // input .src_clk (mclk), // input
.dst_clk (pclk), // input .dst_clk (pclk), // input
.in_pulse (trig_in), // input .in_pulse (trig_in), // input
...@@ -174,7 +177,7 @@ module sens_sync#( ...@@ -174,7 +177,7 @@ module sens_sync#(
// pclk -> mclk // pclk -> mclk
pulse_cross_clock pulse_cross_clock_sof_out_i ( pulse_cross_clock pulse_cross_clock_sof_out_i (
.rst (rst), // input .rst (prst), // input
.src_clk (pclk), // input .src_clk (pclk), // input
.dst_clk (mclk), // input .dst_clk (mclk), // input
.in_pulse (pre_sof_out), // input .in_pulse (pre_sof_out), // input
...@@ -182,7 +185,7 @@ module sens_sync#( ...@@ -182,7 +185,7 @@ module sens_sync#(
.busy() // output .busy() // output
); );
pulse_cross_clock pulse_cross_clock_sof_late_i ( pulse_cross_clock pulse_cross_clock_sof_late_i (
.rst (rst), // input .rst (prst), // input
.src_clk (pclk), // input .src_clk (pclk), // input
.dst_clk (mclk), // input .dst_clk (mclk), // input
.in_pulse (pre_sof_late), // input .in_pulse (pre_sof_late), // input
...@@ -190,9 +193,5 @@ module sens_sync#( ...@@ -190,9 +193,5 @@ module sens_sync#(
.busy() // output .busy() // output
); );
endmodule endmodule
...@@ -158,9 +158,12 @@ module sensor_channel#( ...@@ -158,9 +158,12 @@ module sensor_channel#(
parameter SENS_SS_MOD_PERIOD = 10000 // integer 4000-40000 - SS modulation period in ns parameter SENS_SS_MOD_PERIOD = 10000 // integer 4000-40000 - SS modulation period in ns
) ( ) (
input rst, // input rst,
input pclk, // global clock input, pixel rate (96MHz for MT9P006) input pclk, // global clock input, pixel rate (96MHz for MT9P006)
input pclk2x, // global clock input, double pixel rate (192MHz for MT9P006) input pclk2x, // global clock input, double pixel rate (192MHz for MT9P006)
input mrst, // @posedge mclk, sync reset
input prst, // @posedge pclk, sync reset
// I/O pads, pin names match circuit diagram // I/O pads, pin names match circuit diagram
inout [7:0] sns_dp, inout [7:0] sns_dp,
inout [7:0] sns_dn, inout [7:0] sns_dn,
...@@ -306,8 +309,8 @@ module sensor_channel#( ...@@ -306,8 +309,8 @@ module sensor_channel#(
cmd_stb <= cmd_stb_in; cmd_stb <= cmd_stb_in;
end end
always @ (posedge rst or posedge mclk) begin always @ (posedge mclk) begin
if (rst) mode <= 0; if (mrst) mode <= 0;
else if (sensor_ctrl_we) mode <= sensor_ctrl_data[SENSOR_MODE_WIDTH-1:0]; else if (sensor_ctrl_we) mode <= sensor_ctrl_data[SENSOR_MODE_WIDTH-1:0];
end end
...@@ -327,8 +330,9 @@ module sensor_channel#( ...@@ -327,8 +330,9 @@ module sensor_channel#(
level_cross_clocks level_cross_clocks_en_pclk_i (.clk(pclk), .d_in(en_mclk), .d_out(en_pclk)); level_cross_clocks level_cross_clocks_en_pclk_i (.clk(pclk), .d_in(en_mclk), .d_out(en_pclk));
status_router2 status_router2_sensor_i ( status_router2 status_router2_sensor_i (
.rst (rst), // input .rst (1'b0), //rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.db_in0 (sens_i2c_status_ad), // input[7:0] .db_in0 (sens_i2c_status_ad), // input[7:0]
.rq_in0 (sens_i2c_status_rq), // input .rq_in0 (sens_i2c_status_rq), // input
.start_in0 (sens_i2c_status_start), // output .start_in0 (sens_i2c_status_start), // output
...@@ -347,8 +351,9 @@ module sensor_channel#( ...@@ -347,8 +351,9 @@ module sensor_channel#(
.ADDR_WIDTH (1), .ADDR_WIDTH (1),
.DATA_WIDTH (32) .DATA_WIDTH (32)
) cmd_deser_sens_channel_i ( ) cmd_deser_sens_channel_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (), // output[0:0] - not used .addr (), // output[0:0] - not used
...@@ -370,7 +375,7 @@ module sensor_channel#( ...@@ -370,7 +375,7 @@ module sensor_channel#(
.SENSI2C_IOSTANDARD (SENSI2C_IOSTANDARD), .SENSI2C_IOSTANDARD (SENSI2C_IOSTANDARD),
.SENSI2C_SLEW (SENSI2C_SLEW) .SENSI2C_SLEW (SENSI2C_SLEW)
) sensor_i2c_io_i ( ) sensor_i2c_io_i (
.rst (rst), // input .mrst (mrst), // input
.mclk (mclk), // input .mclk (mclk), // input
.cmd_ad (cmd_ad), // input[7:0] .cmd_ad (cmd_ad), // input[7:0]
.cmd_stb (cmd_stb), // input .cmd_stb (cmd_stb), // input
...@@ -381,7 +386,7 @@ module sensor_channel#( ...@@ -381,7 +386,7 @@ module sensor_channel#(
.scl (sns_scl), // inout .scl (sns_scl), // inout
.sda (sns_sda) // inout .sda (sns_sda) // inout
); );
wire irst; // @ posedge ipclk
sens_parallel12 #( sens_parallel12 #(
.SENSIO_ADDR (SENSIO_ADDR), .SENSIO_ADDR (SENSIO_ADDR),
.SENSIO_ADDR_MASK (SENSIO_ADDR_MASK), .SENSIO_ADDR_MASK (SENSIO_ADDR_MASK),
...@@ -427,8 +432,11 @@ module sensor_channel#( ...@@ -427,8 +432,11 @@ module sensor_channel#(
.SENS_SS_MODE (SENS_SS_MODE), .SENS_SS_MODE (SENS_SS_MODE),
.SENS_SS_MOD_PERIOD (SENS_SS_MOD_PERIOD) .SENS_SS_MOD_PERIOD (SENS_SS_MOD_PERIOD)
) sens_parallel12_i ( ) sens_parallel12_i (
.rst (rst), // input // .rst (rst), // input
.pclk (pclk), // input .pclk (pclk), // input
.mclk_rst (mrst), // input
.prst (prst), // input
.irst (irst), // output
.ipclk (ipclk), // output .ipclk (ipclk), // output
.ipclk2x (), // ipclk2x), // output .ipclk2x (), // ipclk2x), // output
.trigger_mode (trigger_mode), // input .trigger_mode (trigger_mode), // input
...@@ -458,9 +466,11 @@ module sensor_channel#( ...@@ -458,9 +466,11 @@ module sensor_channel#(
.SENSOR_FIFO_2DEPTH (SENSOR_FIFO_2DEPTH), .SENSOR_FIFO_2DEPTH (SENSOR_FIFO_2DEPTH),
.SENSOR_FIFO_DELAY (SENSOR_FIFO_DELAY) .SENSOR_FIFO_DELAY (SENSOR_FIFO_DELAY)
) sensor_fifo_i ( ) sensor_fifo_i (
.rst (rst), // input // .rst (rst), // input
.iclk (ipclk), // input .iclk (ipclk), // input
.pclk (pclk), // input .pclk (pclk), // input
.prst (prst), // input
.irst (irst), // input
.pxd_in (pxd_to_fifo), // input[11:0] .pxd_in (pxd_to_fifo), // input[11:0]
.vact (vact_to_fifo), // input .vact (vact_to_fifo), // input
.hact (hact_to_fifo), // input .hact (hact_to_fifo), // input
...@@ -481,9 +491,10 @@ module sensor_channel#( ...@@ -481,9 +491,10 @@ module sensor_channel#(
.SENS_SYNC_MINBITS (SENS_SYNC_MINBITS), .SENS_SYNC_MINBITS (SENS_SYNC_MINBITS),
.SENS_SYNC_MINPER (SENS_SYNC_MINPER) .SENS_SYNC_MINPER (SENS_SYNC_MINPER)
) sens_sync_i ( ) sens_sync_i (
.rst (rst), // input
.pclk (pclk), // input .pclk (pclk), // input
.mclk (mclk), // input .mclk (mclk), // input
.mrst (mrst), // input
.prst (prst), // input
.en (en_pclk), // input @pclk .en (en_pclk), // input @pclk
.sof_in (sof), // input .sof_in (sof), // input
.eof_in (eof), // input .eof_in (eof), // input
...@@ -514,8 +525,10 @@ module sensor_channel#( ...@@ -514,8 +525,10 @@ module sensor_channel#(
.SENS_GAMMA_MODE_REPET (SENS_GAMMA_MODE_REPET), .SENS_GAMMA_MODE_REPET (SENS_GAMMA_MODE_REPET),
.SENS_GAMMA_MODE_TRIG (SENS_GAMMA_MODE_TRIG) .SENS_GAMMA_MODE_TRIG (SENS_GAMMA_MODE_TRIG)
) sens_gamma_i ( ) sens_gamma_i (
.rst (rst), // input // .rst (rst), // input
.pclk (pclk), // input .pclk (pclk), // input
.mrst (mrst), // input
.prst (prst), // input
.pxd_in (gamma_pxd_in), // input[15:0] .pxd_in (gamma_pxd_in), // input[15:0]
.hact_in (gamma_hact_in), // input .hact_in (gamma_hact_in), // input
.sof_in (gamma_sof_in), // input .sof_in (gamma_sof_in), // input
...@@ -540,7 +553,9 @@ module sensor_channel#( ...@@ -540,7 +553,9 @@ module sensor_channel#(
.HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP), .HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP),
.HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT) .HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT)
) sens_histogram_i ( ) sens_histogram_i (
.rst (rst), // input // .rst (rst), // input
.mrst (mrst), // input
.prst (prst), // input
.pclk (pclk), // input .pclk (pclk), // input
.pclk2x (pclk2x), // input .pclk2x (pclk2x), // input
.sof (gamma_sof_out), // input .sof (gamma_sof_out), // input
...@@ -572,7 +587,9 @@ module sensor_channel#( ...@@ -572,7 +587,9 @@ module sensor_channel#(
.HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP), .HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP),
.HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT) .HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT)
) sens_histogram_i ( ) sens_histogram_i (
.rst (rst), // input // .rst (rst), // input
.mrst (mrst), // input
.prst (prst), // input
.pclk (pclk), // input .pclk (pclk), // input
.pclk2x (pclk2x), // input .pclk2x (pclk2x), // input
.sof (gamma_sof_out), // input .sof (gamma_sof_out), // input
...@@ -604,7 +621,9 @@ module sensor_channel#( ...@@ -604,7 +621,9 @@ module sensor_channel#(
.HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP), .HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP),
.HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT) .HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT)
) sens_histogram_i ( ) sens_histogram_i (
.rst (rst), // input // .rst (rst), // input
.mrst (mrst), // input
.prst (prst), // input
.pclk (pclk), // input .pclk (pclk), // input
.pclk2x (pclk2x), // input .pclk2x (pclk2x), // input
.sof (gamma_sof_out), // input .sof (gamma_sof_out), // input
...@@ -636,7 +655,9 @@ module sensor_channel#( ...@@ -636,7 +655,9 @@ module sensor_channel#(
.HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP), .HISTOGRAM_LEFT_TOP (HISTOGRAM_LEFT_TOP),
.HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT) .HISTOGRAM_WIDTH_HEIGHT (HISTOGRAM_WIDTH_HEIGHT)
) sens_histogram_i ( ) sens_histogram_i (
.rst (rst), // input // .rst (rst), // input
.mrst (mrst), // input
.prst (prst), // input
.pclk (pclk), // input .pclk (pclk), // input
.pclk2x (pclk2x), // input .pclk2x (pclk2x), // input
.sof (gamma_sof_out), // input .sof (gamma_sof_out), // input
......
...@@ -25,9 +25,12 @@ module sensor_fifo #( ...@@ -25,9 +25,12 @@ module sensor_fifo #(
parameter SENSOR_FIFO_2DEPTH = 4, // 4-bit address parameter SENSOR_FIFO_2DEPTH = 4, // 4-bit address
parameter SENSOR_FIFO_DELAY = 7 // approxiametly half (1 << SENSOR_FIFO_2DEPTH) - how long to wait after getting HACT on FIFO before stering it on output parameter SENSOR_FIFO_DELAY = 7 // approxiametly half (1 << SENSOR_FIFO_2DEPTH) - how long to wait after getting HACT on FIFO before stering it on output
)( )(
input rst, // input rst,
input iclk, // input -synchronous clock input iclk, // input -synchronous clock
input pclk, // internal lixel clock input pclk, // internal lixel clock
input prst, // @ posedge pclk
input irst, // @ posedge iclk
input [SENSOR_DATA_WIDTH-1:0] pxd_in, // sensor data @posedge iclk input [SENSOR_DATA_WIDTH-1:0] pxd_in, // sensor data @posedge iclk
input vact, input vact,
input hact, input hact,
...@@ -50,8 +53,8 @@ module sensor_fifo #( ...@@ -50,8 +53,8 @@ module sensor_fifo #(
wire hact_out_start; wire hact_out_start;
assign we=sof_in || eof_in || hact || hact_r; assign we=sof_in || eof_in || hact || hact_r;
always @(posedge rst or posedge iclk) begin always @(posedge iclk) begin
if (rst) {vact_r,hact_r,sof_in,eof_in} <= 0; if (irst) {vact_r,hact_r,sof_in,eof_in} <= 0;
else {vact_r,hact_r,sof_in,eof_in} <= {vact,hact, vact && ! vact_r, vact_r && !vact}; else {vact_r,hact_r,sof_in,eof_in} <= {vact,hact, vact && ! vact_r, vact_r && !vact};
end end
...@@ -59,7 +62,9 @@ module sensor_fifo #( ...@@ -59,7 +62,9 @@ module sensor_fifo #(
.DATA_WIDTH(SENSOR_DATA_WIDTH+3), .DATA_WIDTH(SENSOR_DATA_WIDTH+3),
.DATA_DEPTH(SENSOR_FIFO_2DEPTH) .DATA_DEPTH(SENSOR_FIFO_2DEPTH)
) fifo_cross_clocks_i ( ) fifo_cross_clocks_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.rrst (prst), // input
.wrst (irst), // input
.rclk (pclk), // input .rclk (pclk), // input
.wclk (iclk), // input .wclk (iclk), // input
.we (we), // input .we (we), // input
...@@ -74,7 +79,7 @@ module sensor_fifo #( ...@@ -74,7 +79,7 @@ module sensor_fifo #(
.WIDTH(1) .WIDTH(1)
) hact_dly_16_i ( ) hact_dly_16_i (
.clk(pclk), // input .clk(pclk), // input
.rst(rst), // input .rst(prst), // input
.dly(SENSOR_FIFO_DELAY), // input[3:0] .dly(SENSOR_FIFO_DELAY), // input[3:0]
.din(pre_hact[0] && ! pre_hact[1]), // input[0:0] .din(pre_hact[0] && ! pre_hact[1]), // input[0:0]
.dout(hact_out_start) // output[0:0] .dout(hact_out_start) // output[0:0]
...@@ -89,27 +94,27 @@ module sensor_fifo #( ...@@ -89,27 +94,27 @@ module sensor_fifo #(
assign sof = sof_r; assign sof = sof_r;
assign eof = eof_r; assign eof = eof_r;
always @(posedge rst or posedge iclk) begin always @(posedge iclk) begin
if (rst) re_r <= 0; if (irst) re_r <= 0;
else re_r <= pre_re; else re_r <= pre_re;
if (rst) pre_hact[0] <= 0; if (irst) pre_hact[0] <= 0;
else if (re) pre_hact[0] <= hact_w; else if (re) pre_hact[0] <= hact_w;
if (rst) pre_hact[1] <= 0; if (irst) pre_hact[1] <= 0;
else if (re) pre_hact[1] <= pre_hact[0]; else if (re) pre_hact[1] <= pre_hact[0];
if (rst) pxd_r <= 0; if (irst) pxd_r <= 0;
else if (re) pxd_r <= pxd_w; else if (re) pxd_r <= pxd_w;
if (rst) hact_out_r <= 0; if (irst) hact_out_r <= 0;
else if (hact_out_start) hact_out_r <= 1; else if (hact_out_start) hact_out_r <= 1;
else if (!hact_w) hact_out_r <= 0; else if (!hact_w) hact_out_r <= 0;
if (rst) sof_r <= 0; if (irst) sof_r <= 0;
else sof_r <= re && sof_w; else sof_r <= re && sof_w;
if (rst) eof_r <= 0; if (irst) eof_r <= 0;
else eof_r <= re && eof_w; else eof_r <= re && eof_w;
end end
......
...@@ -30,7 +30,7 @@ module sensor_i2c#( ...@@ -30,7 +30,7 @@ module sensor_i2c#(
parameter SENSI2C_STATUS = 'h1, parameter SENSI2C_STATUS = 'h1,
parameter SENSI2C_STATUS_REG = 'h30 parameter SENSI2C_STATUS_REG = 'h30
)( )(
input rst, input mrst, // @ posedge mclk
input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
input cmd_stb, // strobe (with first byte) for the command a/d input cmd_stb, // strobe (with first byte) for the command a/d
...@@ -207,8 +207,9 @@ module sensor_i2c#( ...@@ -207,8 +207,9 @@ module sensor_i2c#(
.ADDR2 (SENSI2C_CTRL_ADDR), .ADDR2 (SENSI2C_CTRL_ADDR),
.ADDR_MASK2 (SENSI2C_CTRL_MASK) .ADDR_MASK2 (SENSI2C_CTRL_MASK)
) cmd_deser_sens_i2c_i ( ) cmd_deser_sens_i2c_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.ad (cmd_ad), // input[7:0] .ad (cmd_ad), // input[7:0]
.stb (cmd_stb), // input .stb (cmd_stb), // input
.addr (wa), // output[15:0] .addr (wa), // output[15:0]
...@@ -220,8 +221,9 @@ module sensor_i2c#( ...@@ -220,8 +221,9 @@ module sensor_i2c#(
.STATUS_REG_ADDR(SENSI2C_STATUS_REG), .STATUS_REG_ADDR(SENSI2C_STATUS_REG),
.PAYLOAD_BITS(7) // STATUS_PAYLOAD_BITS) .PAYLOAD_BITS(7) // STATUS_PAYLOAD_BITS)
) status_generate_sens_i2c_i ( ) status_generate_sens_i2c_i (
.rst (rst), // input .rst (1'b0), // rst), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.we (set_status_w), // input .we (set_status_w), // input
.wd (di[7:0]), // input[7:0] .wd (di[7:0]), // input[7:0]
.status ({busy, frame_num, sda_in, scl_in}), // input[25:0] .status ({busy, frame_num, sda_in, scl_in}), // input[25:0]
......
...@@ -34,7 +34,7 @@ module sensor_i2c_io#( ...@@ -34,7 +34,7 @@ module sensor_i2c_io#(
parameter SENSI2C_IOSTANDARD = "DEFAULT", parameter SENSI2C_IOSTANDARD = "DEFAULT",
parameter SENSI2C_SLEW = "SLOW" parameter SENSI2C_SLEW = "SLOW"
)( )(
input rst, input mrst, // @mclk
input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3 input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
input cmd_stb, // strobe (with first byte) for the command a/d input cmd_stb, // strobe (with first byte) for the command a/d
...@@ -53,29 +53,29 @@ module sensor_i2c_io#( ...@@ -53,29 +53,29 @@ module sensor_i2c_io#(
wire sda_en; wire sda_en;
sensor_i2c #( sensor_i2c #(
.SENSI2C_ABS_ADDR(SENSI2C_ABS_ADDR), .SENSI2C_ABS_ADDR (SENSI2C_ABS_ADDR),
.SENSI2C_REL_ADDR(SENSI2C_REL_ADDR), .SENSI2C_REL_ADDR (SENSI2C_REL_ADDR),
.SENSI2C_ADDR_MASK(SENSI2C_ADDR_MASK), .SENSI2C_ADDR_MASK (SENSI2C_ADDR_MASK),
.SENSI2C_CTRL_ADDR(SENSI2C_CTRL_ADDR), .SENSI2C_CTRL_ADDR (SENSI2C_CTRL_ADDR),
.SENSI2C_CTRL_MASK(SENSI2C_CTRL_MASK), .SENSI2C_CTRL_MASK (SENSI2C_CTRL_MASK),
.SENSI2C_CTRL(SENSI2C_CTRL), .SENSI2C_CTRL (SENSI2C_CTRL),
.SENSI2C_STATUS(SENSI2C_STATUS), .SENSI2C_STATUS (SENSI2C_STATUS),
.SENSI2C_STATUS_REG(SENSI2C_STATUS_REG) .SENSI2C_STATUS_REG (SENSI2C_STATUS_REG)
) sensor_i2c_i ( ) sensor_i2c_i (
.rst(rst), // input .mrst (mrst), // input
.mclk(mclk), // input .mclk (mclk), // input
.cmd_ad(cmd_ad), // input[7:0] .cmd_ad (cmd_ad), // input[7:0]
.cmd_stb(cmd_stb), // input .cmd_stb (cmd_stb), // input
.status_ad(status_ad), // output[7:0] .status_ad (status_ad), // output[7:0]
.status_rq(status_rq), // output .status_rq (status_rq), // output
.status_start(status_start), // input .status_start (status_start), // input
.frame_sync(frame_sync), // input .frame_sync (frame_sync), // input
.scl_in(scl_in), // input .scl_in (scl_in), // input
.sda_in(sda_in), // input .sda_in (sda_in), // input
.scl_out(scl_out), // output .scl_out (scl_out), // output
.sda_out(sda_out), // output .sda_out (sda_out), // output
.scl_en(scl_en), // output .scl_en (scl_en), // output
.sda_en(sda_en) // output .sda_en (sda_en) // output
); );
iobuf #( iobuf #(
......
...@@ -175,12 +175,15 @@ module sensors393 #( ...@@ -175,12 +175,15 @@ module sensors393 #(
parameter SENS_SS_MOD_PERIOD = 10000 // integer 4000-40000 - SS modulation period in ns parameter SENS_SS_MOD_PERIOD = 10000 // integer 4000-40000 - SS modulation period in ns
) ( ) (
input rst, // input rst,
// will generate it here // will generate it here
input ref_clk, // IODELAY calibration
input dly_rst,
input pclk, // global clock input, pixel rate (96MHz for MT9P006) input pclk, // global clock input, pixel rate (96MHz for MT9P006)
input pclk2x, // global clock input, double pixel rate (192MHz for MT9P006) input pclk2x, // global clock input, double pixel rate (192MHz for MT9P006)
input ref_clk, // IODELAY calibration
input dly_rst,
input mrst, // @posedge mclk, sync reset
input prst, // @posedge pclk, sync reset
input arst, // @posedge aclk, sync reset
// programming interface // programming interface
input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
...@@ -381,22 +384,11 @@ module sensors393 #( ...@@ -381,22 +384,11 @@ module sensors393 #(
.SENS_SS_MODE (SENS_SS_MODE), .SENS_SS_MODE (SENS_SS_MODE),
.SENS_SS_MOD_PERIOD (SENS_SS_MOD_PERIOD) .SENS_SS_MOD_PERIOD (SENS_SS_MOD_PERIOD)
) sensor_channel_i ( ) sensor_channel_i (
.rst (rst), // input // .rst (rst), // input
.pclk (pclk), // input .pclk (pclk), // input
.pclk2x (pclk2x), // input .pclk2x (pclk2x), // input
/* .mrst (mrst), // input
.sns_dp ((i & 2) ? ((i & 1) ? sns4_dp: sns3_dp): ((i & 1) ? sns2_dp: sns1_dp)), // inout[7:0] .prst (prst), // input
.sns_dn ((i & 2) ? ((i & 1) ? sns4_dn: sns3_dn): ((i & 1) ? sns2_dn: sns1_dn)), // inout[7:0]
.sns_clkp ((i & 2) ? ((i & 1) ? sns4_clkp: sns3_clkp):((i & 1) ? sns2_clkp: sns1_clkp)), // inout
.sns_clkn ((i & 2) ? ((i & 1) ? sns4_clkn: sns3_clkn):((i & 1) ? sns2_clkn: sns1_clkn)), // inout
.sns_scl ((i & 2) ? ((i & 1) ? sns4_scl: sns3_scl): ((i & 1) ? sns2_scl: sns1_scl)), // inout
.sns_sda ((i & 2) ? ((i & 1) ? sns4_sda: sns3_sda): ((i & 1) ? sns2_sda: sns1_sda)), // inout
.sns_ctl ((i & 2) ? ((i & 1) ? sns4_ctl: sns3_ctl): ((i & 1) ? sns2_ctl: sns1_ctl)), // inout
// .sns_pg ((i & 2) ? ((i & 1) ? sns4_pg: sns3_pg): ((i & 1) ? sns2_pg: sns1_pg)), // inout
// .sns_pg ({sns4_pg,sns3_pg,sns2_pg,sns1_pg}[i]), // inout
.sns_pg (sns_pg[i]), // inout
*/
.sns_dp (sns_dp[i * 8 +: 8]), // inout[7:0] .sns_dp (sns_dp[i * 8 +: 8]), // inout[7:0]
.sns_dn (sns_dn[i * 8 +: 8]), // inout[7:0] .sns_dn (sns_dn[i * 8 +: 8]), // inout[7:0]
...@@ -459,9 +451,11 @@ module sensors393 #( ...@@ -459,9 +451,11 @@ module sensors393 #(
.HIST_SAXI_MODE_ADDR_MASK (HIST_SAXI_MODE_ADDR_MASK), .HIST_SAXI_MODE_ADDR_MASK (HIST_SAXI_MODE_ADDR_MASK),
.NUM_FRAME_BITS (NUM_FRAME_BITS) .NUM_FRAME_BITS (NUM_FRAME_BITS)
) histogram_saxi_i ( ) histogram_saxi_i (
.rst (rst), // input // .rst (rst), // input
.mclk (mclk), // input .mclk (mclk), // input
.aclk (aclk), // input .aclk (aclk), // input
.mrst (mrst), // input
.arst (arst), // input
.frame0 (frame_num0), // input[3:0] .frame0 (frame_num0), // input[3:0]
.hist_request0 (hist_request[0]), // input .hist_request0 (hist_request[0]), // input
.hist_grant0 (hist_grant[0]), // output .hist_grant0 (hist_grant[0]), // output
...@@ -512,8 +506,9 @@ module sensors393 #( ...@@ -512,8 +506,9 @@ module sensors393 #(
); );
status_router4 status_router4_i ( status_router4 status_router4_i (
.rst (rst), // input .rst (1'b0), // input
.clk (mclk), // input .clk (mclk), // input
.srst (mrst), // input
.db_in0 (status_ad_chn[0 +: 8]), // input[7:0] .db_in0 (status_ad_chn[0 +: 8]), // input[7:0]
.rq_in0 (status_rq_chn[0]), // input .rq_in0 (status_rq_chn[0]), // input
.start_in0 (status_start_chn[0]), // output .start_in0 (status_start_chn[0]), // output
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -21,12 +21,13 @@ ...@@ -21,12 +21,13 @@
`timescale 1ns/1ps `timescale 1ns/1ps
module timestamp_snapshot( module timestamp_snapshot(
input rst, // input rst,
input tclk, // clock that drives time counters input tclk, // clock that drives time counters
input [31:0] sec, // @tclk: current time seconds input [31:0] sec, // @tclk: current time seconds
input [19:0] usec, // @tclk: current time microseconds input [19:0] usec, // @tclk: current time microseconds
// snapshot destination clock domain // snapshot destination clock domain
input sclk, input sclk,
input srst, // @ posedge sclk - sync reset
input snap, input snap,
output pre_stb, // one clock pulse before sending TS data output pre_stb, // one clock pulse before sending TS data
output reg [7:0] ts_data // timestamp data (s0,s1,s2,s3,u0,u1,u2,u3==0) output reg [7:0] ts_data // timestamp data (s0,s1,s2,s3,u0,u1,u2,u3==0)
...@@ -44,8 +45,8 @@ module timestamp_snapshot( ...@@ -44,8 +45,8 @@ module timestamp_snapshot(
if (snap_tclk) sec_usec_snap <= {usec,sec}; if (snap_tclk) sec_usec_snap <= {usec,sec};
end end
always @(posedge rst or posedge sclk) begin always @(posedge sclk) begin
if (rst) snd <= 0; if (srst) snd <= 0;
else if (!pulse_busy && pulse_busy_r) snd <= 1; else if (!pulse_busy && pulse_busy_r) snd <= 1;
else if ((&cntr) || snap) snd <= 0; else if ((&cntr) || snap) snd <= 0;
end end
...@@ -72,7 +73,7 @@ module timestamp_snapshot( ...@@ -72,7 +73,7 @@ module timestamp_snapshot(
pulse_cross_clock #( pulse_cross_clock #(
.EXTRA_DLY (1) .EXTRA_DLY (1)
) snap_tclk_i ( ) snap_tclk_i (
.rst (rst), // input .rst (srst), // input
.src_clk (sclk), // input .src_clk (sclk), // input
.dst_clk (tclk), // input .dst_clk (tclk), // input
.in_pulse (snap), // input .in_pulse (snap), // input
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* Module: level_cross_clocks * Module: level_cross_clocks
* Date:2015-07-19 * Date:2015-07-19
* Author: andrey * Author: Aandrey Filippov
* Description: re-sample signal to a different clock to reduce metastability * Description: re-sample signal to a different clock to reduce metastability
* *
* Copyright (c) 2015 Elphel, Inc . * Copyright (c) 2015 Elphel, Inc .
......
...@@ -35,7 +35,7 @@ module mcont_common_chnbuf_reg #( ...@@ -35,7 +35,7 @@ module mcont_common_chnbuf_reg #(
output reg buf_run output reg buf_run
); );
reg buf_chn_sel; reg buf_chn_sel;
always @ (posedge rst or posedge clk) begin always @ (posedge clk) begin
if (rst) buf_chn_sel <= 0; if (rst) buf_chn_sel <= 0;
else buf_chn_sel <= (ext_buf_rchn==CHN_NUMBER) && !ext_buf_rrefresh; else buf_chn_sel <= (ext_buf_rchn==CHN_NUMBER) && !ext_buf_rrefresh;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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