module_content
stringlengths
18
1.05M
module sync_signal #( parameter WIDTH=1, // width of the input and output signals parameter N=2 // depth of synchronizer )( input wire clk, input wire [WIDTH-1:0] in, output wire [WIDTH-1:0] out ); reg [WIDTH-1:0] sync_reg[N-1:0]; /* * The synchronized output is the last register in the pipeline. */ assign out = sync_reg[N-1]; integer k; always @(posedge clk) begin sync_reg[0] <= in; for (k = 1; k < N; k = k + 1) begin sync_reg[k] <= sync_reg[k-1]; end end endmodule
module sync_signal #( parameter WIDTH=1, // width of the input and output signals parameter N=2 // depth of synchronizer )( input wire clk, input wire [WIDTH-1:0] in, output wire [WIDTH-1:0] out ); reg [WIDTH-1:0] sync_reg[N-1:0]; /* * The synchronized output is the last register in the pipeline. */ assign out = sync_reg[N-1]; integer k; always @(posedge clk) begin sync_reg[0] <= in; for (k = 1; k < N; k = k + 1) begin sync_reg[k] <= sync_reg[k-1]; end end endmodule
module sync_signal #( parameter WIDTH=1, // width of the input and output signals parameter N=2 // depth of synchronizer )( input wire clk, input wire [WIDTH-1:0] in, output wire [WIDTH-1:0] out ); reg [WIDTH-1:0] sync_reg[N-1:0]; /* * The synchronized output is the last register in the pipeline. */ assign out = sync_reg[N-1]; integer k; always @(posedge clk) begin sync_reg[0] <= in; for (k = 1; k < N; k = k + 1) begin sync_reg[k] <= sync_reg[k-1]; end end endmodule
module WireDelay # ( parameter Delay_g = 0, parameter Delay_rd = 0, parameter ERR_INSERT = "OFF" ) ( inout A, inout B, input reset, input phy_init_done ); reg A_r; reg B_r; reg B_inv ; reg line_en; reg B_nonX; assign A = A_r; assign B = B_r; always @ (*) begin if (B === 1'bx) B_nonX <= $random; else B_nonX <= B; end always @(*) begin if((B_nonX == 'b1) || (B_nonX == 'b0)) B_inv <= #0 ~B_nonX ; else B_inv <= #0 'bz ; end always @(*) begin if (!reset) begin A_r <= 1'bz; B_r <= 1'bz; line_en <= 1'b0; end else begin if (line_en) begin B_r <= 1'bz; if ((ERR_INSERT == "ON") & (phy_init_done)) A_r <= #Delay_rd B_inv; else A_r <= #Delay_rd B_nonX; end else begin B_r <= #Delay_g A; A_r <= 1'bz; end end end always @(A or B) begin if (!reset) begin line_en <= 1'b0; end else if (A !== A_r) begin line_en <= 1'b0; end else if (B_r !== B) begin line_en <= 1'b1; end else begin line_en <= line_en; end end endmodule
module altera_reset_controller #( parameter NUM_RESET_INPUTS = 6, parameter USE_RESET_REQUEST_IN0 = 0, parameter USE_RESET_REQUEST_IN1 = 0, parameter USE_RESET_REQUEST_IN2 = 0, parameter USE_RESET_REQUEST_IN3 = 0, parameter USE_RESET_REQUEST_IN4 = 0, parameter USE_RESET_REQUEST_IN5 = 0, parameter USE_RESET_REQUEST_IN6 = 0, parameter USE_RESET_REQUEST_IN7 = 0, parameter USE_RESET_REQUEST_IN8 = 0, parameter USE_RESET_REQUEST_IN9 = 0, parameter USE_RESET_REQUEST_IN10 = 0, parameter USE_RESET_REQUEST_IN11 = 0, parameter USE_RESET_REQUEST_IN12 = 0, parameter USE_RESET_REQUEST_IN13 = 0, parameter USE_RESET_REQUEST_IN14 = 0, parameter USE_RESET_REQUEST_IN15 = 0, parameter OUTPUT_RESET_SYNC_EDGES = "deassert", parameter SYNC_DEPTH = 2, parameter RESET_REQUEST_PRESENT = 0, parameter RESET_REQ_WAIT_TIME = 3, parameter MIN_RST_ASSERTION_TIME = 11, parameter RESET_REQ_EARLY_DSRT_TIME = 4, parameter ADAPT_RESET_REQUEST = 0 ) ( // -------------------------------------- // We support up to 16 reset inputs, for now // -------------------------------------- input reset_in0, input reset_in1, input reset_in2, input reset_in3, input reset_in4, input reset_in5, input reset_in6, input reset_in7, input reset_in8, input reset_in9, input reset_in10, input reset_in11, input reset_in12, input reset_in13, input reset_in14, input reset_in15, input reset_req_in0, input reset_req_in1, input reset_req_in2, input reset_req_in3, input reset_req_in4, input reset_req_in5, input reset_req_in6, input reset_req_in7, input reset_req_in8, input reset_req_in9, input reset_req_in10, input reset_req_in11, input reset_req_in12, input reset_req_in13, input reset_req_in14, input reset_req_in15, input clk, output reg reset_out, output reg reset_req ); // Always use async reset synchronizer if reset_req is used localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert"); // -------------------------------------- // Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1 // -------------------------------------- localparam MIN_METASTABLE = 3; localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME; localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME; localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ? MIN_RST_ASSERTION_TIME + 1 : ( (MIN_RST_ASSERTION_TIME > LARGER)? MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 : MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2 ); localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1; // -------------------------------------- wire merged_reset; wire merged_reset_req_in; wire reset_out_pre; wire reset_req_pre; // Registers and Interconnect (*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain; reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain; reg r_sync_rst; reg r_early_rst; // -------------------------------------- // "Or" all the input resets together // -------------------------------------- assign merged_reset = ( reset_in0 | reset_in1 | reset_in2 | reset_in3 | reset_in4 | reset_in5 | reset_in6 | reset_in7 | reset_in8 | reset_in9 | reset_in10 | reset_in11 | reset_in12 | reset_in13 | reset_in14 | reset_in15 ); assign merged_reset_req_in = ( ( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) | ( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) | ( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) | ( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) | ( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) | ( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) | ( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) | ( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) | ( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) | ( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) | ( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) | ( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) | ( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) | ( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) | ( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) | ( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0) ); // -------------------------------------- // And if required, synchronize it to the required clock domain, // with the correct synchronization type // -------------------------------------- generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin assign reset_out_pre = merged_reset; assign reset_req_pre = merged_reset_req_in; end else begin altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET) ) alt_rst_sync_uq1 ( .clk (clk), .reset_in (merged_reset), .reset_out (reset_out_pre) ); altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(0) ) alt_rst_req_sync_uq1 ( .clk (clk), .reset_in (merged_reset_req_in), .reset_out (reset_req_pre) ); end endgenerate generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )| ( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin always @* begin reset_out = reset_out_pre; reset_req = reset_req_pre; end end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin wire reset_out_pre2; altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH+1), .ASYNC_RESET(0) ) alt_rst_sync_uq2 ( .clk (clk), .reset_in (reset_out_pre), .reset_out (reset_out_pre2) ); always @* begin reset_out = reset_out_pre2; reset_req = reset_req_pre; end end else begin // 3-FF Metastability Synchronizer initial begin altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}}; end always @(posedge clk) begin altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <= {altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre}; end // Synchronous reset pipe initial begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end always @(posedge clk) begin if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1) begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end else begin r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]}; end end // Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition // matches the early input. always @(posedge clk) begin case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst}) 3'b000: r_sync_rst <= 1'b0; // Not reset 3'b001: r_sync_rst <= 1'b0; 3'b010: r_sync_rst <= 1'b0; 3'b011: r_sync_rst <= 1'b1; 3'b100: r_sync_rst <= 1'b1; 3'b101: r_sync_rst <= 1'b1; 3'b110: r_sync_rst <= 1'b1; 3'b111: r_sync_rst <= 1'b1; // In Reset default: r_sync_rst <= 1'b1; endcase case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre}) 2'b00: r_early_rst <= 1'b0; // Not reset 2'b01: r_early_rst <= 1'b1; // Coming out of reset 2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design. 2'b11: r_early_rst <= 1'b1; // Held in reset default: r_early_rst <= 1'b1; endcase end always @* begin reset_out = r_sync_rst; reset_req = r_early_rst; end end endgenerate endmodule
module altera_reset_controller #( parameter NUM_RESET_INPUTS = 6, parameter USE_RESET_REQUEST_IN0 = 0, parameter USE_RESET_REQUEST_IN1 = 0, parameter USE_RESET_REQUEST_IN2 = 0, parameter USE_RESET_REQUEST_IN3 = 0, parameter USE_RESET_REQUEST_IN4 = 0, parameter USE_RESET_REQUEST_IN5 = 0, parameter USE_RESET_REQUEST_IN6 = 0, parameter USE_RESET_REQUEST_IN7 = 0, parameter USE_RESET_REQUEST_IN8 = 0, parameter USE_RESET_REQUEST_IN9 = 0, parameter USE_RESET_REQUEST_IN10 = 0, parameter USE_RESET_REQUEST_IN11 = 0, parameter USE_RESET_REQUEST_IN12 = 0, parameter USE_RESET_REQUEST_IN13 = 0, parameter USE_RESET_REQUEST_IN14 = 0, parameter USE_RESET_REQUEST_IN15 = 0, parameter OUTPUT_RESET_SYNC_EDGES = "deassert", parameter SYNC_DEPTH = 2, parameter RESET_REQUEST_PRESENT = 0, parameter RESET_REQ_WAIT_TIME = 3, parameter MIN_RST_ASSERTION_TIME = 11, parameter RESET_REQ_EARLY_DSRT_TIME = 4, parameter ADAPT_RESET_REQUEST = 0 ) ( // -------------------------------------- // We support up to 16 reset inputs, for now // -------------------------------------- input reset_in0, input reset_in1, input reset_in2, input reset_in3, input reset_in4, input reset_in5, input reset_in6, input reset_in7, input reset_in8, input reset_in9, input reset_in10, input reset_in11, input reset_in12, input reset_in13, input reset_in14, input reset_in15, input reset_req_in0, input reset_req_in1, input reset_req_in2, input reset_req_in3, input reset_req_in4, input reset_req_in5, input reset_req_in6, input reset_req_in7, input reset_req_in8, input reset_req_in9, input reset_req_in10, input reset_req_in11, input reset_req_in12, input reset_req_in13, input reset_req_in14, input reset_req_in15, input clk, output reg reset_out, output reg reset_req ); // Always use async reset synchronizer if reset_req is used localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert"); // -------------------------------------- // Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1 // -------------------------------------- localparam MIN_METASTABLE = 3; localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME; localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME; localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ? MIN_RST_ASSERTION_TIME + 1 : ( (MIN_RST_ASSERTION_TIME > LARGER)? MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 : MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2 ); localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1; // -------------------------------------- wire merged_reset; wire merged_reset_req_in; wire reset_out_pre; wire reset_req_pre; // Registers and Interconnect (*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain; reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain; reg r_sync_rst; reg r_early_rst; // -------------------------------------- // "Or" all the input resets together // -------------------------------------- assign merged_reset = ( reset_in0 | reset_in1 | reset_in2 | reset_in3 | reset_in4 | reset_in5 | reset_in6 | reset_in7 | reset_in8 | reset_in9 | reset_in10 | reset_in11 | reset_in12 | reset_in13 | reset_in14 | reset_in15 ); assign merged_reset_req_in = ( ( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) | ( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) | ( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) | ( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) | ( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) | ( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) | ( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) | ( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) | ( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) | ( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) | ( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) | ( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) | ( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) | ( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) | ( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) | ( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0) ); // -------------------------------------- // And if required, synchronize it to the required clock domain, // with the correct synchronization type // -------------------------------------- generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin assign reset_out_pre = merged_reset; assign reset_req_pre = merged_reset_req_in; end else begin altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET) ) alt_rst_sync_uq1 ( .clk (clk), .reset_in (merged_reset), .reset_out (reset_out_pre) ); altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(0) ) alt_rst_req_sync_uq1 ( .clk (clk), .reset_in (merged_reset_req_in), .reset_out (reset_req_pre) ); end endgenerate generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )| ( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin always @* begin reset_out = reset_out_pre; reset_req = reset_req_pre; end end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin wire reset_out_pre2; altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH+1), .ASYNC_RESET(0) ) alt_rst_sync_uq2 ( .clk (clk), .reset_in (reset_out_pre), .reset_out (reset_out_pre2) ); always @* begin reset_out = reset_out_pre2; reset_req = reset_req_pre; end end else begin // 3-FF Metastability Synchronizer initial begin altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}}; end always @(posedge clk) begin altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <= {altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre}; end // Synchronous reset pipe initial begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end always @(posedge clk) begin if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1) begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end else begin r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]}; end end // Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition // matches the early input. always @(posedge clk) begin case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst}) 3'b000: r_sync_rst <= 1'b0; // Not reset 3'b001: r_sync_rst <= 1'b0; 3'b010: r_sync_rst <= 1'b0; 3'b011: r_sync_rst <= 1'b1; 3'b100: r_sync_rst <= 1'b1; 3'b101: r_sync_rst <= 1'b1; 3'b110: r_sync_rst <= 1'b1; 3'b111: r_sync_rst <= 1'b1; // In Reset default: r_sync_rst <= 1'b1; endcase case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre}) 2'b00: r_early_rst <= 1'b0; // Not reset 2'b01: r_early_rst <= 1'b1; // Coming out of reset 2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design. 2'b11: r_early_rst <= 1'b1; // Held in reset default: r_early_rst <= 1'b1; endcase end always @* begin reset_out = r_sync_rst; reset_req = r_early_rst; end end endgenerate endmodule
module altera_reset_controller #( parameter NUM_RESET_INPUTS = 6, parameter USE_RESET_REQUEST_IN0 = 0, parameter USE_RESET_REQUEST_IN1 = 0, parameter USE_RESET_REQUEST_IN2 = 0, parameter USE_RESET_REQUEST_IN3 = 0, parameter USE_RESET_REQUEST_IN4 = 0, parameter USE_RESET_REQUEST_IN5 = 0, parameter USE_RESET_REQUEST_IN6 = 0, parameter USE_RESET_REQUEST_IN7 = 0, parameter USE_RESET_REQUEST_IN8 = 0, parameter USE_RESET_REQUEST_IN9 = 0, parameter USE_RESET_REQUEST_IN10 = 0, parameter USE_RESET_REQUEST_IN11 = 0, parameter USE_RESET_REQUEST_IN12 = 0, parameter USE_RESET_REQUEST_IN13 = 0, parameter USE_RESET_REQUEST_IN14 = 0, parameter USE_RESET_REQUEST_IN15 = 0, parameter OUTPUT_RESET_SYNC_EDGES = "deassert", parameter SYNC_DEPTH = 2, parameter RESET_REQUEST_PRESENT = 0, parameter RESET_REQ_WAIT_TIME = 3, parameter MIN_RST_ASSERTION_TIME = 11, parameter RESET_REQ_EARLY_DSRT_TIME = 4, parameter ADAPT_RESET_REQUEST = 0 ) ( // -------------------------------------- // We support up to 16 reset inputs, for now // -------------------------------------- input reset_in0, input reset_in1, input reset_in2, input reset_in3, input reset_in4, input reset_in5, input reset_in6, input reset_in7, input reset_in8, input reset_in9, input reset_in10, input reset_in11, input reset_in12, input reset_in13, input reset_in14, input reset_in15, input reset_req_in0, input reset_req_in1, input reset_req_in2, input reset_req_in3, input reset_req_in4, input reset_req_in5, input reset_req_in6, input reset_req_in7, input reset_req_in8, input reset_req_in9, input reset_req_in10, input reset_req_in11, input reset_req_in12, input reset_req_in13, input reset_req_in14, input reset_req_in15, input clk, output reg reset_out, output reg reset_req ); // Always use async reset synchronizer if reset_req is used localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert"); // -------------------------------------- // Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1 // -------------------------------------- localparam MIN_METASTABLE = 3; localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME; localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME; localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ? MIN_RST_ASSERTION_TIME + 1 : ( (MIN_RST_ASSERTION_TIME > LARGER)? MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 : MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2 ); localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1; // -------------------------------------- wire merged_reset; wire merged_reset_req_in; wire reset_out_pre; wire reset_req_pre; // Registers and Interconnect (*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain; reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain; reg r_sync_rst; reg r_early_rst; // -------------------------------------- // "Or" all the input resets together // -------------------------------------- assign merged_reset = ( reset_in0 | reset_in1 | reset_in2 | reset_in3 | reset_in4 | reset_in5 | reset_in6 | reset_in7 | reset_in8 | reset_in9 | reset_in10 | reset_in11 | reset_in12 | reset_in13 | reset_in14 | reset_in15 ); assign merged_reset_req_in = ( ( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) | ( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) | ( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) | ( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) | ( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) | ( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) | ( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) | ( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) | ( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) | ( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) | ( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) | ( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) | ( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) | ( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) | ( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) | ( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0) ); // -------------------------------------- // And if required, synchronize it to the required clock domain, // with the correct synchronization type // -------------------------------------- generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin assign reset_out_pre = merged_reset; assign reset_req_pre = merged_reset_req_in; end else begin altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET) ) alt_rst_sync_uq1 ( .clk (clk), .reset_in (merged_reset), .reset_out (reset_out_pre) ); altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(0) ) alt_rst_req_sync_uq1 ( .clk (clk), .reset_in (merged_reset_req_in), .reset_out (reset_req_pre) ); end endgenerate generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )| ( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin always @* begin reset_out = reset_out_pre; reset_req = reset_req_pre; end end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin wire reset_out_pre2; altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH+1), .ASYNC_RESET(0) ) alt_rst_sync_uq2 ( .clk (clk), .reset_in (reset_out_pre), .reset_out (reset_out_pre2) ); always @* begin reset_out = reset_out_pre2; reset_req = reset_req_pre; end end else begin // 3-FF Metastability Synchronizer initial begin altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}}; end always @(posedge clk) begin altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <= {altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre}; end // Synchronous reset pipe initial begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end always @(posedge clk) begin if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1) begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end else begin r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]}; end end // Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition // matches the early input. always @(posedge clk) begin case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst}) 3'b000: r_sync_rst <= 1'b0; // Not reset 3'b001: r_sync_rst <= 1'b0; 3'b010: r_sync_rst <= 1'b0; 3'b011: r_sync_rst <= 1'b1; 3'b100: r_sync_rst <= 1'b1; 3'b101: r_sync_rst <= 1'b1; 3'b110: r_sync_rst <= 1'b1; 3'b111: r_sync_rst <= 1'b1; // In Reset default: r_sync_rst <= 1'b1; endcase case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre}) 2'b00: r_early_rst <= 1'b0; // Not reset 2'b01: r_early_rst <= 1'b1; // Coming out of reset 2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design. 2'b11: r_early_rst <= 1'b1; // Held in reset default: r_early_rst <= 1'b1; endcase end always @* begin reset_out = r_sync_rst; reset_req = r_early_rst; end end endgenerate endmodule
module altera_reset_controller #( parameter NUM_RESET_INPUTS = 6, parameter USE_RESET_REQUEST_IN0 = 0, parameter USE_RESET_REQUEST_IN1 = 0, parameter USE_RESET_REQUEST_IN2 = 0, parameter USE_RESET_REQUEST_IN3 = 0, parameter USE_RESET_REQUEST_IN4 = 0, parameter USE_RESET_REQUEST_IN5 = 0, parameter USE_RESET_REQUEST_IN6 = 0, parameter USE_RESET_REQUEST_IN7 = 0, parameter USE_RESET_REQUEST_IN8 = 0, parameter USE_RESET_REQUEST_IN9 = 0, parameter USE_RESET_REQUEST_IN10 = 0, parameter USE_RESET_REQUEST_IN11 = 0, parameter USE_RESET_REQUEST_IN12 = 0, parameter USE_RESET_REQUEST_IN13 = 0, parameter USE_RESET_REQUEST_IN14 = 0, parameter USE_RESET_REQUEST_IN15 = 0, parameter OUTPUT_RESET_SYNC_EDGES = "deassert", parameter SYNC_DEPTH = 2, parameter RESET_REQUEST_PRESENT = 0, parameter RESET_REQ_WAIT_TIME = 3, parameter MIN_RST_ASSERTION_TIME = 11, parameter RESET_REQ_EARLY_DSRT_TIME = 4, parameter ADAPT_RESET_REQUEST = 0 ) ( // -------------------------------------- // We support up to 16 reset inputs, for now // -------------------------------------- input reset_in0, input reset_in1, input reset_in2, input reset_in3, input reset_in4, input reset_in5, input reset_in6, input reset_in7, input reset_in8, input reset_in9, input reset_in10, input reset_in11, input reset_in12, input reset_in13, input reset_in14, input reset_in15, input reset_req_in0, input reset_req_in1, input reset_req_in2, input reset_req_in3, input reset_req_in4, input reset_req_in5, input reset_req_in6, input reset_req_in7, input reset_req_in8, input reset_req_in9, input reset_req_in10, input reset_req_in11, input reset_req_in12, input reset_req_in13, input reset_req_in14, input reset_req_in15, input clk, output reg reset_out, output reg reset_req ); // Always use async reset synchronizer if reset_req is used localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert"); // -------------------------------------- // Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1 // -------------------------------------- localparam MIN_METASTABLE = 3; localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME; localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME; localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ? MIN_RST_ASSERTION_TIME + 1 : ( (MIN_RST_ASSERTION_TIME > LARGER)? MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 : MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2 ); localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1; // -------------------------------------- wire merged_reset; wire merged_reset_req_in; wire reset_out_pre; wire reset_req_pre; // Registers and Interconnect (*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain; reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain; reg r_sync_rst; reg r_early_rst; // -------------------------------------- // "Or" all the input resets together // -------------------------------------- assign merged_reset = ( reset_in0 | reset_in1 | reset_in2 | reset_in3 | reset_in4 | reset_in5 | reset_in6 | reset_in7 | reset_in8 | reset_in9 | reset_in10 | reset_in11 | reset_in12 | reset_in13 | reset_in14 | reset_in15 ); assign merged_reset_req_in = ( ( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) | ( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) | ( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) | ( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) | ( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) | ( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) | ( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) | ( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) | ( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) | ( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) | ( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) | ( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) | ( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) | ( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) | ( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) | ( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0) ); // -------------------------------------- // And if required, synchronize it to the required clock domain, // with the correct synchronization type // -------------------------------------- generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin assign reset_out_pre = merged_reset; assign reset_req_pre = merged_reset_req_in; end else begin altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET) ) alt_rst_sync_uq1 ( .clk (clk), .reset_in (merged_reset), .reset_out (reset_out_pre) ); altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(0) ) alt_rst_req_sync_uq1 ( .clk (clk), .reset_in (merged_reset_req_in), .reset_out (reset_req_pre) ); end endgenerate generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )| ( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin always @* begin reset_out = reset_out_pre; reset_req = reset_req_pre; end end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin wire reset_out_pre2; altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH+1), .ASYNC_RESET(0) ) alt_rst_sync_uq2 ( .clk (clk), .reset_in (reset_out_pre), .reset_out (reset_out_pre2) ); always @* begin reset_out = reset_out_pre2; reset_req = reset_req_pre; end end else begin // 3-FF Metastability Synchronizer initial begin altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}}; end always @(posedge clk) begin altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <= {altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre}; end // Synchronous reset pipe initial begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end always @(posedge clk) begin if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1) begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end else begin r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]}; end end // Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition // matches the early input. always @(posedge clk) begin case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst}) 3'b000: r_sync_rst <= 1'b0; // Not reset 3'b001: r_sync_rst <= 1'b0; 3'b010: r_sync_rst <= 1'b0; 3'b011: r_sync_rst <= 1'b1; 3'b100: r_sync_rst <= 1'b1; 3'b101: r_sync_rst <= 1'b1; 3'b110: r_sync_rst <= 1'b1; 3'b111: r_sync_rst <= 1'b1; // In Reset default: r_sync_rst <= 1'b1; endcase case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre}) 2'b00: r_early_rst <= 1'b0; // Not reset 2'b01: r_early_rst <= 1'b1; // Coming out of reset 2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design. 2'b11: r_early_rst <= 1'b1; // Held in reset default: r_early_rst <= 1'b1; endcase end always @* begin reset_out = r_sync_rst; reset_req = r_early_rst; end end endgenerate endmodule
module altera_reset_controller #( parameter NUM_RESET_INPUTS = 6, parameter USE_RESET_REQUEST_IN0 = 0, parameter USE_RESET_REQUEST_IN1 = 0, parameter USE_RESET_REQUEST_IN2 = 0, parameter USE_RESET_REQUEST_IN3 = 0, parameter USE_RESET_REQUEST_IN4 = 0, parameter USE_RESET_REQUEST_IN5 = 0, parameter USE_RESET_REQUEST_IN6 = 0, parameter USE_RESET_REQUEST_IN7 = 0, parameter USE_RESET_REQUEST_IN8 = 0, parameter USE_RESET_REQUEST_IN9 = 0, parameter USE_RESET_REQUEST_IN10 = 0, parameter USE_RESET_REQUEST_IN11 = 0, parameter USE_RESET_REQUEST_IN12 = 0, parameter USE_RESET_REQUEST_IN13 = 0, parameter USE_RESET_REQUEST_IN14 = 0, parameter USE_RESET_REQUEST_IN15 = 0, parameter OUTPUT_RESET_SYNC_EDGES = "deassert", parameter SYNC_DEPTH = 2, parameter RESET_REQUEST_PRESENT = 0, parameter RESET_REQ_WAIT_TIME = 3, parameter MIN_RST_ASSERTION_TIME = 11, parameter RESET_REQ_EARLY_DSRT_TIME = 4, parameter ADAPT_RESET_REQUEST = 0 ) ( // -------------------------------------- // We support up to 16 reset inputs, for now // -------------------------------------- input reset_in0, input reset_in1, input reset_in2, input reset_in3, input reset_in4, input reset_in5, input reset_in6, input reset_in7, input reset_in8, input reset_in9, input reset_in10, input reset_in11, input reset_in12, input reset_in13, input reset_in14, input reset_in15, input reset_req_in0, input reset_req_in1, input reset_req_in2, input reset_req_in3, input reset_req_in4, input reset_req_in5, input reset_req_in6, input reset_req_in7, input reset_req_in8, input reset_req_in9, input reset_req_in10, input reset_req_in11, input reset_req_in12, input reset_req_in13, input reset_req_in14, input reset_req_in15, input clk, output reg reset_out, output reg reset_req ); // Always use async reset synchronizer if reset_req is used localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert"); // -------------------------------------- // Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1 // -------------------------------------- localparam MIN_METASTABLE = 3; localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME; localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME; localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ? MIN_RST_ASSERTION_TIME + 1 : ( (MIN_RST_ASSERTION_TIME > LARGER)? MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 : MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2 ); localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1; // -------------------------------------- wire merged_reset; wire merged_reset_req_in; wire reset_out_pre; wire reset_req_pre; // Registers and Interconnect (*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain; reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain; reg r_sync_rst; reg r_early_rst; // -------------------------------------- // "Or" all the input resets together // -------------------------------------- assign merged_reset = ( reset_in0 | reset_in1 | reset_in2 | reset_in3 | reset_in4 | reset_in5 | reset_in6 | reset_in7 | reset_in8 | reset_in9 | reset_in10 | reset_in11 | reset_in12 | reset_in13 | reset_in14 | reset_in15 ); assign merged_reset_req_in = ( ( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) | ( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) | ( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) | ( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) | ( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) | ( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) | ( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) | ( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) | ( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) | ( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) | ( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) | ( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) | ( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) | ( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) | ( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) | ( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0) ); // -------------------------------------- // And if required, synchronize it to the required clock domain, // with the correct synchronization type // -------------------------------------- generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin assign reset_out_pre = merged_reset; assign reset_req_pre = merged_reset_req_in; end else begin altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET) ) alt_rst_sync_uq1 ( .clk (clk), .reset_in (merged_reset), .reset_out (reset_out_pre) ); altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(0) ) alt_rst_req_sync_uq1 ( .clk (clk), .reset_in (merged_reset_req_in), .reset_out (reset_req_pre) ); end endgenerate generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )| ( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin always @* begin reset_out = reset_out_pre; reset_req = reset_req_pre; end end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin wire reset_out_pre2; altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH+1), .ASYNC_RESET(0) ) alt_rst_sync_uq2 ( .clk (clk), .reset_in (reset_out_pre), .reset_out (reset_out_pre2) ); always @* begin reset_out = reset_out_pre2; reset_req = reset_req_pre; end end else begin // 3-FF Metastability Synchronizer initial begin altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}}; end always @(posedge clk) begin altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <= {altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre}; end // Synchronous reset pipe initial begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end always @(posedge clk) begin if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1) begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end else begin r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]}; end end // Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition // matches the early input. always @(posedge clk) begin case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst}) 3'b000: r_sync_rst <= 1'b0; // Not reset 3'b001: r_sync_rst <= 1'b0; 3'b010: r_sync_rst <= 1'b0; 3'b011: r_sync_rst <= 1'b1; 3'b100: r_sync_rst <= 1'b1; 3'b101: r_sync_rst <= 1'b1; 3'b110: r_sync_rst <= 1'b1; 3'b111: r_sync_rst <= 1'b1; // In Reset default: r_sync_rst <= 1'b1; endcase case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre}) 2'b00: r_early_rst <= 1'b0; // Not reset 2'b01: r_early_rst <= 1'b1; // Coming out of reset 2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design. 2'b11: r_early_rst <= 1'b1; // Held in reset default: r_early_rst <= 1'b1; endcase end always @* begin reset_out = r_sync_rst; reset_req = r_early_rst; end end endgenerate endmodule
module altera_reset_controller #( parameter NUM_RESET_INPUTS = 6, parameter USE_RESET_REQUEST_IN0 = 0, parameter USE_RESET_REQUEST_IN1 = 0, parameter USE_RESET_REQUEST_IN2 = 0, parameter USE_RESET_REQUEST_IN3 = 0, parameter USE_RESET_REQUEST_IN4 = 0, parameter USE_RESET_REQUEST_IN5 = 0, parameter USE_RESET_REQUEST_IN6 = 0, parameter USE_RESET_REQUEST_IN7 = 0, parameter USE_RESET_REQUEST_IN8 = 0, parameter USE_RESET_REQUEST_IN9 = 0, parameter USE_RESET_REQUEST_IN10 = 0, parameter USE_RESET_REQUEST_IN11 = 0, parameter USE_RESET_REQUEST_IN12 = 0, parameter USE_RESET_REQUEST_IN13 = 0, parameter USE_RESET_REQUEST_IN14 = 0, parameter USE_RESET_REQUEST_IN15 = 0, parameter OUTPUT_RESET_SYNC_EDGES = "deassert", parameter SYNC_DEPTH = 2, parameter RESET_REQUEST_PRESENT = 0, parameter RESET_REQ_WAIT_TIME = 3, parameter MIN_RST_ASSERTION_TIME = 11, parameter RESET_REQ_EARLY_DSRT_TIME = 4, parameter ADAPT_RESET_REQUEST = 0 ) ( // -------------------------------------- // We support up to 16 reset inputs, for now // -------------------------------------- input reset_in0, input reset_in1, input reset_in2, input reset_in3, input reset_in4, input reset_in5, input reset_in6, input reset_in7, input reset_in8, input reset_in9, input reset_in10, input reset_in11, input reset_in12, input reset_in13, input reset_in14, input reset_in15, input reset_req_in0, input reset_req_in1, input reset_req_in2, input reset_req_in3, input reset_req_in4, input reset_req_in5, input reset_req_in6, input reset_req_in7, input reset_req_in8, input reset_req_in9, input reset_req_in10, input reset_req_in11, input reset_req_in12, input reset_req_in13, input reset_req_in14, input reset_req_in15, input clk, output reg reset_out, output reg reset_req ); // Always use async reset synchronizer if reset_req is used localparam ASYNC_RESET = (OUTPUT_RESET_SYNC_EDGES == "deassert"); // -------------------------------------- // Local parameter to control the reset_req and reset_out timing when RESET_REQUEST_PRESENT==1 // -------------------------------------- localparam MIN_METASTABLE = 3; localparam RSTREQ_ASRT_SYNC_TAP = MIN_METASTABLE + RESET_REQ_WAIT_TIME; localparam LARGER = RESET_REQ_WAIT_TIME > RESET_REQ_EARLY_DSRT_TIME ? RESET_REQ_WAIT_TIME : RESET_REQ_EARLY_DSRT_TIME; localparam ASSERTION_CHAIN_LENGTH = (MIN_METASTABLE > LARGER) ? MIN_RST_ASSERTION_TIME + 1 : ( (MIN_RST_ASSERTION_TIME > LARGER)? MIN_RST_ASSERTION_TIME + (LARGER - MIN_METASTABLE + 1) + 1 : MIN_RST_ASSERTION_TIME + RESET_REQ_EARLY_DSRT_TIME + RESET_REQ_WAIT_TIME - MIN_METASTABLE + 2 ); localparam RESET_REQ_DRST_TAP = RESET_REQ_EARLY_DSRT_TIME + 1; // -------------------------------------- wire merged_reset; wire merged_reset_req_in; wire reset_out_pre; wire reset_req_pre; // Registers and Interconnect (*preserve*) reg [RSTREQ_ASRT_SYNC_TAP: 0] altera_reset_synchronizer_int_chain; reg [ASSERTION_CHAIN_LENGTH-1: 0] r_sync_rst_chain; reg r_sync_rst; reg r_early_rst; // -------------------------------------- // "Or" all the input resets together // -------------------------------------- assign merged_reset = ( reset_in0 | reset_in1 | reset_in2 | reset_in3 | reset_in4 | reset_in5 | reset_in6 | reset_in7 | reset_in8 | reset_in9 | reset_in10 | reset_in11 | reset_in12 | reset_in13 | reset_in14 | reset_in15 ); assign merged_reset_req_in = ( ( (USE_RESET_REQUEST_IN0 == 1) ? reset_req_in0 : 1'b0) | ( (USE_RESET_REQUEST_IN1 == 1) ? reset_req_in1 : 1'b0) | ( (USE_RESET_REQUEST_IN2 == 1) ? reset_req_in2 : 1'b0) | ( (USE_RESET_REQUEST_IN3 == 1) ? reset_req_in3 : 1'b0) | ( (USE_RESET_REQUEST_IN4 == 1) ? reset_req_in4 : 1'b0) | ( (USE_RESET_REQUEST_IN5 == 1) ? reset_req_in5 : 1'b0) | ( (USE_RESET_REQUEST_IN6 == 1) ? reset_req_in6 : 1'b0) | ( (USE_RESET_REQUEST_IN7 == 1) ? reset_req_in7 : 1'b0) | ( (USE_RESET_REQUEST_IN8 == 1) ? reset_req_in8 : 1'b0) | ( (USE_RESET_REQUEST_IN9 == 1) ? reset_req_in9 : 1'b0) | ( (USE_RESET_REQUEST_IN10 == 1) ? reset_req_in10 : 1'b0) | ( (USE_RESET_REQUEST_IN11 == 1) ? reset_req_in11 : 1'b0) | ( (USE_RESET_REQUEST_IN12 == 1) ? reset_req_in12 : 1'b0) | ( (USE_RESET_REQUEST_IN13 == 1) ? reset_req_in13 : 1'b0) | ( (USE_RESET_REQUEST_IN14 == 1) ? reset_req_in14 : 1'b0) | ( (USE_RESET_REQUEST_IN15 == 1) ? reset_req_in15 : 1'b0) ); // -------------------------------------- // And if required, synchronize it to the required clock domain, // with the correct synchronization type // -------------------------------------- generate if (OUTPUT_RESET_SYNC_EDGES == "none" && (RESET_REQUEST_PRESENT==0)) begin assign reset_out_pre = merged_reset; assign reset_req_pre = merged_reset_req_in; end else begin altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(RESET_REQUEST_PRESENT? 1'b1 : ASYNC_RESET) ) alt_rst_sync_uq1 ( .clk (clk), .reset_in (merged_reset), .reset_out (reset_out_pre) ); altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH), .ASYNC_RESET(0) ) alt_rst_req_sync_uq1 ( .clk (clk), .reset_in (merged_reset_req_in), .reset_out (reset_req_pre) ); end endgenerate generate if ( ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==0) )| ( (ADAPT_RESET_REQUEST == 1) && (OUTPUT_RESET_SYNC_EDGES != "deassert") ) ) begin always @* begin reset_out = reset_out_pre; reset_req = reset_req_pre; end end else if ( (RESET_REQUEST_PRESENT == 0) && (ADAPT_RESET_REQUEST==1) ) begin wire reset_out_pre2; altera_reset_synchronizer #( .DEPTH (SYNC_DEPTH+1), .ASYNC_RESET(0) ) alt_rst_sync_uq2 ( .clk (clk), .reset_in (reset_out_pre), .reset_out (reset_out_pre2) ); always @* begin reset_out = reset_out_pre2; reset_req = reset_req_pre; end end else begin // 3-FF Metastability Synchronizer initial begin altera_reset_synchronizer_int_chain <= {RSTREQ_ASRT_SYNC_TAP{1'b1}}; end always @(posedge clk) begin altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP:0] <= {altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP-1:0], reset_out_pre}; end // Synchronous reset pipe initial begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end always @(posedge clk) begin if (altera_reset_synchronizer_int_chain[MIN_METASTABLE-1] == 1'b1) begin r_sync_rst_chain <= {ASSERTION_CHAIN_LENGTH{1'b1}}; end else begin r_sync_rst_chain <= {1'b0, r_sync_rst_chain[ASSERTION_CHAIN_LENGTH-1:1]}; end end // Standard synchronous reset output. From 0-1, the transition lags the early output. For 1->0, the transition // matches the early input. always @(posedge clk) begin case ({altera_reset_synchronizer_int_chain[RSTREQ_ASRT_SYNC_TAP], r_sync_rst_chain[1], r_sync_rst}) 3'b000: r_sync_rst <= 1'b0; // Not reset 3'b001: r_sync_rst <= 1'b0; 3'b010: r_sync_rst <= 1'b0; 3'b011: r_sync_rst <= 1'b1; 3'b100: r_sync_rst <= 1'b1; 3'b101: r_sync_rst <= 1'b1; 3'b110: r_sync_rst <= 1'b1; 3'b111: r_sync_rst <= 1'b1; // In Reset default: r_sync_rst <= 1'b1; endcase case ({r_sync_rst_chain[1], r_sync_rst_chain[RESET_REQ_DRST_TAP] | reset_req_pre}) 2'b00: r_early_rst <= 1'b0; // Not reset 2'b01: r_early_rst <= 1'b1; // Coming out of reset 2'b10: r_early_rst <= 1'b0; // Spurious reset - should not be possible via synchronous design. 2'b11: r_early_rst <= 1'b1; // Held in reset default: r_early_rst <= 1'b1; endcase end always @* begin reset_out = r_sync_rst; reset_req = r_early_rst; end end endgenerate endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module control(clk,en,dsp_sel,an); input clk, en; output [1:0]dsp_sel; output [3:0]an; wire a,b,c,d,e,f,g,h,i,j,k,l; assign an[3] = a; assign an[2] = b; assign an[1] = c; assign an[0] = d; assign dsp_sel[1] = e; assign dsp_sel[0] = i; FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF3( .Q(a), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(d), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF2( .Q(b), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(a), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF1( .Q(c), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(b), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF0( .Q(d), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(c), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF7( .Q(e), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(h), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF6( .Q(f), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(e), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF5( .Q(g), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(f), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF4( .Q(h), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(g), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF11( .Q(i), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(l), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF10( .Q(j), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(i), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b1) // Initial value of register (1'b0 or 1'b1) ) DFF9( .Q(k), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(j), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); FDRSE #( .INIT(1'b0) // Initial value of register (1'b0 or 1'b1) ) DFF8( .Q(l), // Data output .C(clk), // Clock input .CE(en), // Clock enable input .D(k), // Data input .R(1'b0), // Synchronous reset input .S(1'b0) // Synchronous set input ); endmodule
module fifo_1kx16 ( aclr, clock, data, rdreq, wrreq, almost_empty, empty, full, q, usedw); input aclr; input clock; input [15:0] data; input rdreq; input wrreq; output almost_empty; output empty; output full; output [15:0] q; output [9:0] usedw; endmodule
module fifo_1kx16 ( aclr, clock, data, rdreq, wrreq, almost_empty, empty, full, q, usedw); input aclr; input clock; input [15:0] data; input rdreq; input wrreq; output almost_empty; output empty; output full; output [15:0] q; output [9:0] usedw; endmodule
module fifo_1kx16 ( aclr, clock, data, rdreq, wrreq, almost_empty, empty, full, q, usedw); input aclr; input clock; input [15:0] data; input rdreq; input wrreq; output almost_empty; output empty; output full; output [15:0] q; output [9:0] usedw; endmodule
module dyn_pll # (parameter SPEED_MHZ = 25 ) (CLKIN_IN, CLKFX1_OUT, CLKFX2_OUT, CLKDV_OUT, DCM_SP_LOCKED_OUT, dcm_progclk, dcm_progdata, dcm_progen, dcm_reset, dcm_progdone, dcm_locked, dcm_status); input CLKIN_IN; wire CLKIN_IBUFG_OUT; wire CLK0_OUT; output CLKFX1_OUT; output CLKFX2_OUT; output CLKDV_OUT; output DCM_SP_LOCKED_OUT; input dcm_progclk; input dcm_progdata; input dcm_progen; input dcm_reset; output dcm_progdone; output dcm_locked; output [2:1] dcm_status; wire CLKFB_IN; wire CLKIN_IBUFG; wire CLK0_BUF; wire CLKFX1_BUF; wire CLKFX2_BUF; wire CLKDV_BUF; wire GND_BIT; wire dcm_progclk_buf; assign GND_BIT = 0; assign CLKIN_IBUFG_OUT = CLKIN_IBUFG; assign CLK0_OUT = CLKFB_IN; IBUFG CLKIN_IBUFG_INST (.I(CLKIN_IN), .O(CLKIN_IBUFG)); BUFG CLK0_BUFG_INST (.I(CLK0_BUF), .O(CLKFB_IN)); BUFG CLKFX1_BUFG_INST (.I(CLKFX1_BUF), .O(CLKFX1_OUT)); BUFG CLKFX2_BUFG_INST (.I(CLKFX2_BUF), .O(CLKFX2_OUT)); BUFG CLKDV_BUFG_INST (.I(CLKDV_BUF), .O(CLKDV_OUT)); BUFG DCMPROGCLK_BUFG_INST (.I(dcm_progclk), .O(dcm_progclk_buf)); // 100 MHZ osc gives fixed 50MHz CLKFX1, 12.5MHZ CLKDV DCM_SP #( .CLK_FEEDBACK("1X"), .CLKDV_DIVIDE(8.0), .CLKFX_DIVIDE(8), .CLKFX_MULTIPLY(4), .CLKIN_DIVIDE_BY_2("FALSE"), .CLKIN_PERIOD(10.000), .CLKOUT_PHASE_SHIFT("NONE"), .DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), .DFS_FREQUENCY_MODE("LOW"), .DLL_FREQUENCY_MODE("LOW"), .DUTY_CYCLE_CORRECTION("TRUE"), .FACTORY_JF(16'hC080), .PHASE_SHIFT(0), .STARTUP_WAIT("FALSE") ) DCM_SP_INST (.CLKFB(CLKFB_IN), .CLKIN(CLKIN_IBUFG), .DSSEN(GND_BIT), .PSCLK(GND_BIT), .PSEN(GND_BIT), .PSINCDEC(GND_BIT), .RST(GND_BIT), .CLKDV(CLKDV_BUF), .CLKFX(CLKFX1_BUF), .CLKFX180(), .CLK0(CLK0_BUF), .CLK2X(), .CLK2X180(), .CLK90(), .CLK180(), .CLK270(), .LOCKED(DCM_SP_LOCKED_OUT), .PSDONE(), .STATUS()); DCM_CLKGEN #( .CLKFX_DIVIDE(100), // 100Mhz osc so gives steps of 1MHz .CLKFX_MULTIPLY(SPEED_MHZ), .CLKFXDV_DIVIDE(2), // Unused .CLKIN_PERIOD(10.0), .CLKFX_MD_MAX(0.000), .SPREAD_SPECTRUM("NONE"), .STARTUP_WAIT("FALSE") ) DCM_CLKGEN_INST ( .CLKIN(CLKIN_IBUFG), .CLKFX(CLKFX2_BUF), .FREEZEDCM(1'b0), .PROGCLK(dcm_progclk_buf), .PROGDATA(dcm_progdata), .PROGEN(dcm_progen), .PROGDONE(dcm_progdone), .LOCKED(dcm_locked), .STATUS(dcm_status), .RST(dcm_reset) ); endmodule
module dyn_pll # (parameter SPEED_MHZ = 25 ) (CLKIN_IN, CLKFX1_OUT, CLKFX2_OUT, CLKDV_OUT, DCM_SP_LOCKED_OUT, dcm_progclk, dcm_progdata, dcm_progen, dcm_reset, dcm_progdone, dcm_locked, dcm_status); input CLKIN_IN; wire CLKIN_IBUFG_OUT; wire CLK0_OUT; output CLKFX1_OUT; output CLKFX2_OUT; output CLKDV_OUT; output DCM_SP_LOCKED_OUT; input dcm_progclk; input dcm_progdata; input dcm_progen; input dcm_reset; output dcm_progdone; output dcm_locked; output [2:1] dcm_status; wire CLKFB_IN; wire CLKIN_IBUFG; wire CLK0_BUF; wire CLKFX1_BUF; wire CLKFX2_BUF; wire CLKDV_BUF; wire GND_BIT; wire dcm_progclk_buf; assign GND_BIT = 0; assign CLKIN_IBUFG_OUT = CLKIN_IBUFG; assign CLK0_OUT = CLKFB_IN; IBUFG CLKIN_IBUFG_INST (.I(CLKIN_IN), .O(CLKIN_IBUFG)); BUFG CLK0_BUFG_INST (.I(CLK0_BUF), .O(CLKFB_IN)); BUFG CLKFX1_BUFG_INST (.I(CLKFX1_BUF), .O(CLKFX1_OUT)); BUFG CLKFX2_BUFG_INST (.I(CLKFX2_BUF), .O(CLKFX2_OUT)); BUFG CLKDV_BUFG_INST (.I(CLKDV_BUF), .O(CLKDV_OUT)); BUFG DCMPROGCLK_BUFG_INST (.I(dcm_progclk), .O(dcm_progclk_buf)); // 100 MHZ osc gives fixed 50MHz CLKFX1, 12.5MHZ CLKDV DCM_SP #( .CLK_FEEDBACK("1X"), .CLKDV_DIVIDE(8.0), .CLKFX_DIVIDE(8), .CLKFX_MULTIPLY(4), .CLKIN_DIVIDE_BY_2("FALSE"), .CLKIN_PERIOD(10.000), .CLKOUT_PHASE_SHIFT("NONE"), .DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), .DFS_FREQUENCY_MODE("LOW"), .DLL_FREQUENCY_MODE("LOW"), .DUTY_CYCLE_CORRECTION("TRUE"), .FACTORY_JF(16'hC080), .PHASE_SHIFT(0), .STARTUP_WAIT("FALSE") ) DCM_SP_INST (.CLKFB(CLKFB_IN), .CLKIN(CLKIN_IBUFG), .DSSEN(GND_BIT), .PSCLK(GND_BIT), .PSEN(GND_BIT), .PSINCDEC(GND_BIT), .RST(GND_BIT), .CLKDV(CLKDV_BUF), .CLKFX(CLKFX1_BUF), .CLKFX180(), .CLK0(CLK0_BUF), .CLK2X(), .CLK2X180(), .CLK90(), .CLK180(), .CLK270(), .LOCKED(DCM_SP_LOCKED_OUT), .PSDONE(), .STATUS()); DCM_CLKGEN #( .CLKFX_DIVIDE(100), // 100Mhz osc so gives steps of 1MHz .CLKFX_MULTIPLY(SPEED_MHZ), .CLKFXDV_DIVIDE(2), // Unused .CLKIN_PERIOD(10.0), .CLKFX_MD_MAX(0.000), .SPREAD_SPECTRUM("NONE"), .STARTUP_WAIT("FALSE") ) DCM_CLKGEN_INST ( .CLKIN(CLKIN_IBUFG), .CLKFX(CLKFX2_BUF), .FREEZEDCM(1'b0), .PROGCLK(dcm_progclk_buf), .PROGDATA(dcm_progdata), .PROGEN(dcm_progen), .PROGDONE(dcm_progdone), .LOCKED(dcm_locked), .STATUS(dcm_status), .RST(dcm_reset) ); endmodule
module fifo_4kx16_dc ( aclr, data, rdclk, rdreq, wrclk, wrreq, q, rdempty, rdusedw, wrfull, wrusedw); input aclr; input [15:0] data; input rdclk; input rdreq; input wrclk; input wrreq; output [15:0] q; output rdempty; output [11:0] rdusedw; output wrfull; output [11:0] wrusedw; wire sub_wire0; wire [11:0] sub_wire1; wire sub_wire2; wire [15:0] sub_wire3; wire [11:0] sub_wire4; wire rdempty = sub_wire0; wire [11:0] wrusedw = sub_wire1[11:0]; wire wrfull = sub_wire2; wire [15:0] q = sub_wire3[15:0]; wire [11:0] rdusedw = sub_wire4[11:0]; dcfifo dcfifo_component ( .wrclk (wrclk), .rdreq (rdreq), .aclr (aclr), .rdclk (rdclk), .wrreq (wrreq), .data (data), .rdempty (sub_wire0), .wrusedw (sub_wire1), .wrfull (sub_wire2), .q (sub_wire3), .rdusedw (sub_wire4) // synopsys translate_off , .wrempty (), .rdfull () // synopsys translate_on ); defparam dcfifo_component.add_ram_output_register = "OFF", dcfifo_component.clocks_are_synchronized = "FALSE", dcfifo_component.intended_device_family = "Cyclone", dcfifo_component.lpm_numwords = 4096, dcfifo_component.lpm_showahead = "ON", dcfifo_component.lpm_type = "dcfifo", dcfifo_component.lpm_width = 16, dcfifo_component.lpm_widthu = 12, dcfifo_component.overflow_checking = "OFF", dcfifo_component.underflow_checking = "OFF", dcfifo_component.use_eab = "ON"; endmodule
module fifo_4kx16_dc ( aclr, data, rdclk, rdreq, wrclk, wrreq, q, rdempty, rdusedw, wrfull, wrusedw); input aclr; input [15:0] data; input rdclk; input rdreq; input wrclk; input wrreq; output [15:0] q; output rdempty; output [11:0] rdusedw; output wrfull; output [11:0] wrusedw; wire sub_wire0; wire [11:0] sub_wire1; wire sub_wire2; wire [15:0] sub_wire3; wire [11:0] sub_wire4; wire rdempty = sub_wire0; wire [11:0] wrusedw = sub_wire1[11:0]; wire wrfull = sub_wire2; wire [15:0] q = sub_wire3[15:0]; wire [11:0] rdusedw = sub_wire4[11:0]; dcfifo dcfifo_component ( .wrclk (wrclk), .rdreq (rdreq), .aclr (aclr), .rdclk (rdclk), .wrreq (wrreq), .data (data), .rdempty (sub_wire0), .wrusedw (sub_wire1), .wrfull (sub_wire2), .q (sub_wire3), .rdusedw (sub_wire4) // synopsys translate_off , .wrempty (), .rdfull () // synopsys translate_on ); defparam dcfifo_component.add_ram_output_register = "OFF", dcfifo_component.clocks_are_synchronized = "FALSE", dcfifo_component.intended_device_family = "Cyclone", dcfifo_component.lpm_numwords = 4096, dcfifo_component.lpm_showahead = "ON", dcfifo_component.lpm_type = "dcfifo", dcfifo_component.lpm_width = 16, dcfifo_component.lpm_widthu = 12, dcfifo_component.overflow_checking = "OFF", dcfifo_component.underflow_checking = "OFF", dcfifo_component.use_eab = "ON"; endmodule
module fifo_4kx16_dc ( aclr, data, rdclk, rdreq, wrclk, wrreq, q, rdempty, rdusedw, wrfull, wrusedw); input aclr; input [15:0] data; input rdclk; input rdreq; input wrclk; input wrreq; output [15:0] q; output rdempty; output [11:0] rdusedw; output wrfull; output [11:0] wrusedw; wire sub_wire0; wire [11:0] sub_wire1; wire sub_wire2; wire [15:0] sub_wire3; wire [11:0] sub_wire4; wire rdempty = sub_wire0; wire [11:0] wrusedw = sub_wire1[11:0]; wire wrfull = sub_wire2; wire [15:0] q = sub_wire3[15:0]; wire [11:0] rdusedw = sub_wire4[11:0]; dcfifo dcfifo_component ( .wrclk (wrclk), .rdreq (rdreq), .aclr (aclr), .rdclk (rdclk), .wrreq (wrreq), .data (data), .rdempty (sub_wire0), .wrusedw (sub_wire1), .wrfull (sub_wire2), .q (sub_wire3), .rdusedw (sub_wire4) // synopsys translate_off , .wrempty (), .rdfull () // synopsys translate_on ); defparam dcfifo_component.add_ram_output_register = "OFF", dcfifo_component.clocks_are_synchronized = "FALSE", dcfifo_component.intended_device_family = "Cyclone", dcfifo_component.lpm_numwords = 4096, dcfifo_component.lpm_showahead = "ON", dcfifo_component.lpm_type = "dcfifo", dcfifo_component.lpm_width = 16, dcfifo_component.lpm_widthu = 12, dcfifo_component.overflow_checking = "OFF", dcfifo_component.underflow_checking = "OFF", dcfifo_component.use_eab = "ON"; endmodule
module fifo_4kx16_dc ( aclr, data, rdclk, rdreq, wrclk, wrreq, q, rdempty, rdusedw, wrfull, wrusedw); input aclr; input [15:0] data; input rdclk; input rdreq; input wrclk; input wrreq; output [15:0] q; output rdempty; output [11:0] rdusedw; output wrfull; output [11:0] wrusedw; wire sub_wire0; wire [11:0] sub_wire1; wire sub_wire2; wire [15:0] sub_wire3; wire [11:0] sub_wire4; wire rdempty = sub_wire0; wire [11:0] wrusedw = sub_wire1[11:0]; wire wrfull = sub_wire2; wire [15:0] q = sub_wire3[15:0]; wire [11:0] rdusedw = sub_wire4[11:0]; dcfifo dcfifo_component ( .wrclk (wrclk), .rdreq (rdreq), .aclr (aclr), .rdclk (rdclk), .wrreq (wrreq), .data (data), .rdempty (sub_wire0), .wrusedw (sub_wire1), .wrfull (sub_wire2), .q (sub_wire3), .rdusedw (sub_wire4) // synopsys translate_off , .wrempty (), .rdfull () // synopsys translate_on ); defparam dcfifo_component.add_ram_output_register = "OFF", dcfifo_component.clocks_are_synchronized = "FALSE", dcfifo_component.intended_device_family = "Cyclone", dcfifo_component.lpm_numwords = 4096, dcfifo_component.lpm_showahead = "ON", dcfifo_component.lpm_type = "dcfifo", dcfifo_component.lpm_width = 16, dcfifo_component.lpm_widthu = 12, dcfifo_component.overflow_checking = "OFF", dcfifo_component.underflow_checking = "OFF", dcfifo_component.use_eab = "ON"; endmodule
module fifo_4kx16_dc ( aclr, data, rdclk, rdreq, wrclk, wrreq, q, rdempty, rdusedw, wrfull, wrusedw); input aclr; input [15:0] data; input rdclk; input rdreq; input wrclk; input wrreq; output [15:0] q; output rdempty; output [11:0] rdusedw; output wrfull; output [11:0] wrusedw; wire sub_wire0; wire [11:0] sub_wire1; wire sub_wire2; wire [15:0] sub_wire3; wire [11:0] sub_wire4; wire rdempty = sub_wire0; wire [11:0] wrusedw = sub_wire1[11:0]; wire wrfull = sub_wire2; wire [15:0] q = sub_wire3[15:0]; wire [11:0] rdusedw = sub_wire4[11:0]; dcfifo dcfifo_component ( .wrclk (wrclk), .rdreq (rdreq), .aclr (aclr), .rdclk (rdclk), .wrreq (wrreq), .data (data), .rdempty (sub_wire0), .wrusedw (sub_wire1), .wrfull (sub_wire2), .q (sub_wire3), .rdusedw (sub_wire4) // synopsys translate_off , .wrempty (), .rdfull () // synopsys translate_on ); defparam dcfifo_component.add_ram_output_register = "OFF", dcfifo_component.clocks_are_synchronized = "FALSE", dcfifo_component.intended_device_family = "Cyclone", dcfifo_component.lpm_numwords = 4096, dcfifo_component.lpm_showahead = "ON", dcfifo_component.lpm_type = "dcfifo", dcfifo_component.lpm_width = 16, dcfifo_component.lpm_widthu = 12, dcfifo_component.overflow_checking = "OFF", dcfifo_component.underflow_checking = "OFF", dcfifo_component.use_eab = "ON"; endmodule
module. // 1 => FWD_REV = Both FWD and REV (fully-registered) // 2 => FWD = The master VALID and payload signals are registrated. // 3 => REV = The slave ready signal is registrated // 4 => SLAVE_FWD = All slave side signals and master VALID and payload are registrated. // 5 => SLAVE_RDY = All slave side signals and master READY are registrated. // 6 => INPUTS = Slave and Master side inputs are registrated. // 7 => LIGHT_WT = 1-stage pipeline register with bubble cycle, both FWD and REV pipelining parameter integer C_REG_CONFIG_AW = 0, parameter integer C_REG_CONFIG_W = 0, parameter integer C_REG_CONFIG_B = 0, parameter integer C_REG_CONFIG_AR = 0, parameter integer C_REG_CONFIG_R = 0 ) ( // System Signals input wire aclk, input wire aresetn, // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_awid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_awaddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_awlen, input wire [3-1:0] s_axi_awsize, input wire [2-1:0] s_axi_awburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_awlock, input wire [4-1:0] s_axi_awcache, input wire [3-1:0] s_axi_awprot, input wire [4-1:0] s_axi_awregion, input wire [4-1:0] s_axi_awqos, input wire [C_AXI_AWUSER_WIDTH-1:0] s_axi_awuser, input wire s_axi_awvalid, output wire s_axi_awready, // Slave Interface Write Data Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_wid, input wire [C_AXI_DATA_WIDTH-1:0] s_axi_wdata, input wire [C_AXI_DATA_WIDTH/8-1:0] s_axi_wstrb, input wire s_axi_wlast, input wire [C_AXI_WUSER_WIDTH-1:0] s_axi_wuser, input wire s_axi_wvalid, output wire s_axi_wready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_bid, output wire [2-1:0] s_axi_bresp, output wire [C_AXI_BUSER_WIDTH-1:0] s_axi_buser, output wire s_axi_bvalid, input wire s_axi_bready, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_arid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_araddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_arlen, input wire [3-1:0] s_axi_arsize, input wire [2-1:0] s_axi_arburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_arlock, input wire [4-1:0] s_axi_arcache, input wire [3-1:0] s_axi_arprot, input wire [4-1:0] s_axi_arregion, input wire [4-1:0] s_axi_arqos, input wire [C_AXI_ARUSER_WIDTH-1:0] s_axi_aruser, input wire s_axi_arvalid, output wire s_axi_arready, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_rid, output wire [C_AXI_DATA_WIDTH-1:0] s_axi_rdata, output wire [2-1:0] s_axi_rresp, output wire s_axi_rlast, output wire [C_AXI_RUSER_WIDTH-1:0] s_axi_ruser, output wire s_axi_rvalid, input wire s_axi_rready, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] m_axi_awid, output wire [C_AXI_ADDR_WIDTH-1:0] m_axi_awaddr, output wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] m_axi_awlen, output wire [3-1:0] m_axi_awsize, output wire [2-1:0] m_axi_awburst, output wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] m_axi_awlock, output wire [4-1:0] m_axi_awcache, output wire [3-1:0] m_axi_awprot, output wire [4-1:0] m_axi_awregion, output wire [4-1:0] m_axi_awqos, output wire [C_AXI_AWUSER_WIDTH-1:0] m_axi_awuser, output wire m_axi_awvalid, input wire m_axi_awready, // Master Interface Write Data Ports output wire [C_AXI_ID_WIDTH-1:0] m_axi_wid, output wire [C_AXI_DATA_WIDTH-1:0] m_axi_wdata, output wire [C_AXI_DATA_WIDTH/8-1:0] m_axi_wstrb, output wire m_axi_wlast, output wire [C_AXI_WUSER_WIDTH-1:0] m_axi_wuser, output wire m_axi_wvalid, input wire m_axi_wready, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] m_axi_bid, input wire [2-1:0] m_axi_bresp, input wire [C_AXI_BUSER_WIDTH-1:0] m_axi_buser, input wire m_axi_bvalid, output wire m_axi_bready, // Master Interface Read Address Port output wire [C_AXI_ID_WIDTH-1:0] m_axi_arid, output wire [C_AXI_ADDR_WIDTH-1:0] m_axi_araddr, output wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] m_axi_arlen, output wire [3-1:0] m_axi_arsize, output wire [2-1:0] m_axi_arburst, output wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] m_axi_arlock, output wire [4-1:0] m_axi_arcache, output wire [3-1:0] m_axi_arprot, output wire [4-1:0] m_axi_arregion, output wire [4-1:0] m_axi_arqos, output wire [C_AXI_ARUSER_WIDTH-1:0] m_axi_aruser, output wire m_axi_arvalid, input wire m_axi_arready, // Master Interface Read Data Ports input wire [C_AXI_ID_WIDTH-1:0] m_axi_rid, input wire [C_AXI_DATA_WIDTH-1:0] m_axi_rdata, input wire [2-1:0] m_axi_rresp, input wire m_axi_rlast, input wire [C_AXI_RUSER_WIDTH-1:0] m_axi_ruser, input wire m_axi_rvalid, output wire m_axi_rready ); wire reset; localparam C_AXI_SUPPORTS_REGION_SIGNALS = (C_AXI_PROTOCOL == 0) ? 1 : 0; `include "axi_infrastructure_v1_1_header.vh" wire [G_AXI_AWPAYLOAD_WIDTH-1:0] s_awpayload; wire [G_AXI_AWPAYLOAD_WIDTH-1:0] m_awpayload; wire [G_AXI_WPAYLOAD_WIDTH-1:0] s_wpayload; wire [G_AXI_WPAYLOAD_WIDTH-1:0] m_wpayload; wire [G_AXI_BPAYLOAD_WIDTH-1:0] s_bpayload; wire [G_AXI_BPAYLOAD_WIDTH-1:0] m_bpayload; wire [G_AXI_ARPAYLOAD_WIDTH-1:0] s_arpayload; wire [G_AXI_ARPAYLOAD_WIDTH-1:0] m_arpayload; wire [G_AXI_RPAYLOAD_WIDTH-1:0] s_rpayload; wire [G_AXI_RPAYLOAD_WIDTH-1:0] m_rpayload; assign reset = ~aresetn; axi_infrastructure_v1_1_axi2vector #( .C_AXI_PROTOCOL ( C_AXI_PROTOCOL ) , .C_AXI_ID_WIDTH ( C_AXI_ID_WIDTH ) , .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) , .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ) , .C_AXI_SUPPORTS_USER_SIGNALS ( C_AXI_SUPPORTS_USER_SIGNALS ) , .C_AXI_SUPPORTS_REGION_SIGNALS ( C_AXI_SUPPORTS_REGION_SIGNALS ) , .C_AXI_AWUSER_WIDTH ( C_AXI_AWUSER_WIDTH ) , .C_AXI_ARUSER_WIDTH ( C_AXI_ARUSER_WIDTH ) , .C_AXI_WUSER_WIDTH ( C_AXI_WUSER_WIDTH ) , .C_AXI_RUSER_WIDTH ( C_AXI_RUSER_WIDTH ) , .C_AXI_BUSER_WIDTH ( C_AXI_BUSER_WIDTH ) , .C_AWPAYLOAD_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_WPAYLOAD_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_BPAYLOAD_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_ARPAYLOAD_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_RPAYLOAD_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) ) axi_infrastructure_v1_1_axi2vector_0 ( .s_axi_awid ( s_axi_awid ) , .s_axi_awaddr ( s_axi_awaddr ) , .s_axi_awlen ( s_axi_awlen ) , .s_axi_awsize ( s_axi_awsize ) , .s_axi_awburst ( s_axi_awburst ) , .s_axi_awlock ( s_axi_awlock ) , .s_axi_awcache ( s_axi_awcache ) , .s_axi_awprot ( s_axi_awprot ) , .s_axi_awqos ( s_axi_awqos ) , .s_axi_awuser ( s_axi_awuser ) , .s_axi_awregion ( s_axi_awregion ) , .s_axi_wid ( s_axi_wid ) , .s_axi_wdata ( s_axi_wdata ) , .s_axi_wstrb ( s_axi_wstrb ) , .s_axi_wlast ( s_axi_wlast ) , .s_axi_wuser ( s_axi_wuser ) , .s_axi_bid ( s_axi_bid ) , .s_axi_bresp ( s_axi_bresp ) , .s_axi_buser ( s_axi_buser ) , .s_axi_arid ( s_axi_arid ) , .s_axi_araddr ( s_axi_araddr ) , .s_axi_arlen ( s_axi_arlen ) , .s_axi_arsize ( s_axi_arsize ) , .s_axi_arburst ( s_axi_arburst ) , .s_axi_arlock ( s_axi_arlock ) , .s_axi_arcache ( s_axi_arcache ) , .s_axi_arprot ( s_axi_arprot ) , .s_axi_arqos ( s_axi_arqos ) , .s_axi_aruser ( s_axi_aruser ) , .s_axi_arregion ( s_axi_arregion ) , .s_axi_rid ( s_axi_rid ) , .s_axi_rdata ( s_axi_rdata ) , .s_axi_rresp ( s_axi_rresp ) , .s_axi_rlast ( s_axi_rlast ) , .s_axi_ruser ( s_axi_ruser ) , .s_awpayload ( s_awpayload ) , .s_wpayload ( s_wpayload ) , .s_bpayload ( s_bpayload ) , .s_arpayload ( s_arpayload ) , .s_rpayload ( s_rpayload ) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_AW ) ) aw_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_awpayload), .S_VALID(s_axi_awvalid), .S_READY(s_axi_awready), // Master side .M_PAYLOAD_DATA(m_awpayload), .M_VALID(m_axi_awvalid), .M_READY(m_axi_awready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_W ) ) w_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_wpayload), .S_VALID(s_axi_wvalid), .S_READY(s_axi_wready), // Master side .M_PAYLOAD_DATA(m_wpayload), .M_VALID(m_axi_wvalid), .M_READY(m_axi_wready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_B ) ) b_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(m_bpayload), .S_VALID(m_axi_bvalid), .S_READY(m_axi_bready), // Master side .M_PAYLOAD_DATA(s_bpayload), .M_VALID(s_axi_bvalid), .M_READY(s_axi_bready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_AR ) ) ar_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_arpayload), .S_VALID(s_axi_arvalid), .S_READY(s_axi_arready), // Master side .M_PAYLOAD_DATA(m_arpayload), .M_VALID(m_axi_arvalid), .M_READY(m_axi_arready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_R ) ) r_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(m_rpayload), .S_VALID(m_axi_rvalid), .S_READY(m_axi_rready), // Master side .M_PAYLOAD_DATA(s_rpayload), .M_VALID(s_axi_rvalid), .M_READY(s_axi_rready) ); axi_infrastructure_v1_1_vector2axi #( .C_AXI_PROTOCOL ( C_AXI_PROTOCOL ) , .C_AXI_ID_WIDTH ( C_AXI_ID_WIDTH ) , .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) , .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ) , .C_AXI_SUPPORTS_USER_SIGNALS ( C_AXI_SUPPORTS_USER_SIGNALS ) , .C_AXI_SUPPORTS_REGION_SIGNALS ( C_AXI_SUPPORTS_REGION_SIGNALS ) , .C_AXI_AWUSER_WIDTH ( C_AXI_AWUSER_WIDTH ) , .C_AXI_ARUSER_WIDTH ( C_AXI_ARUSER_WIDTH ) , .C_AXI_WUSER_WIDTH ( C_AXI_WUSER_WIDTH ) , .C_AXI_RUSER_WIDTH ( C_AXI_RUSER_WIDTH ) , .C_AXI_BUSER_WIDTH ( C_AXI_BUSER_WIDTH ) , .C_AWPAYLOAD_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_WPAYLOAD_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_BPAYLOAD_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_ARPAYLOAD_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_RPAYLOAD_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) ) axi_infrastructure_v1_1_vector2axi_0 ( .m_awpayload ( m_awpayload ) , .m_wpayload ( m_wpayload ) , .m_bpayload ( m_bpayload ) , .m_arpayload ( m_arpayload ) , .m_rpayload ( m_rpayload ) , .m_axi_awid ( m_axi_awid ) , .m_axi_awaddr ( m_axi_awaddr ) , .m_axi_awlen ( m_axi_awlen ) , .m_axi_awsize ( m_axi_awsize ) , .m_axi_awburst ( m_axi_awburst ) , .m_axi_awlock ( m_axi_awlock ) , .m_axi_awcache ( m_axi_awcache ) , .m_axi_awprot ( m_axi_awprot ) , .m_axi_awqos ( m_axi_awqos ) , .m_axi_awuser ( m_axi_awuser ) , .m_axi_awregion ( m_axi_awregion ) , .m_axi_wid ( m_axi_wid ) , .m_axi_wdata ( m_axi_wdata ) , .m_axi_wstrb ( m_axi_wstrb ) , .m_axi_wlast ( m_axi_wlast ) , .m_axi_wuser ( m_axi_wuser ) , .m_axi_bid ( m_axi_bid ) , .m_axi_bresp ( m_axi_bresp ) , .m_axi_buser ( m_axi_buser ) , .m_axi_arid ( m_axi_arid ) , .m_axi_araddr ( m_axi_araddr ) , .m_axi_arlen ( m_axi_arlen ) , .m_axi_arsize ( m_axi_arsize ) , .m_axi_arburst ( m_axi_arburst ) , .m_axi_arlock ( m_axi_arlock ) , .m_axi_arcache ( m_axi_arcache ) , .m_axi_arprot ( m_axi_arprot ) , .m_axi_arqos ( m_axi_arqos ) , .m_axi_aruser ( m_axi_aruser ) , .m_axi_arregion ( m_axi_arregion ) , .m_axi_rid ( m_axi_rid ) , .m_axi_rdata ( m_axi_rdata ) , .m_axi_rresp ( m_axi_rresp ) , .m_axi_rlast ( m_axi_rlast ) , .m_axi_ruser ( m_axi_ruser ) ); endmodule
module. // 1 => FWD_REV = Both FWD and REV (fully-registered) // 2 => FWD = The master VALID and payload signals are registrated. // 3 => REV = The slave ready signal is registrated // 4 => SLAVE_FWD = All slave side signals and master VALID and payload are registrated. // 5 => SLAVE_RDY = All slave side signals and master READY are registrated. // 6 => INPUTS = Slave and Master side inputs are registrated. // 7 => LIGHT_WT = 1-stage pipeline register with bubble cycle, both FWD and REV pipelining parameter integer C_REG_CONFIG_AW = 0, parameter integer C_REG_CONFIG_W = 0, parameter integer C_REG_CONFIG_B = 0, parameter integer C_REG_CONFIG_AR = 0, parameter integer C_REG_CONFIG_R = 0 ) ( // System Signals input wire aclk, input wire aresetn, // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_awid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_awaddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_awlen, input wire [3-1:0] s_axi_awsize, input wire [2-1:0] s_axi_awburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_awlock, input wire [4-1:0] s_axi_awcache, input wire [3-1:0] s_axi_awprot, input wire [4-1:0] s_axi_awregion, input wire [4-1:0] s_axi_awqos, input wire [C_AXI_AWUSER_WIDTH-1:0] s_axi_awuser, input wire s_axi_awvalid, output wire s_axi_awready, // Slave Interface Write Data Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_wid, input wire [C_AXI_DATA_WIDTH-1:0] s_axi_wdata, input wire [C_AXI_DATA_WIDTH/8-1:0] s_axi_wstrb, input wire s_axi_wlast, input wire [C_AXI_WUSER_WIDTH-1:0] s_axi_wuser, input wire s_axi_wvalid, output wire s_axi_wready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_bid, output wire [2-1:0] s_axi_bresp, output wire [C_AXI_BUSER_WIDTH-1:0] s_axi_buser, output wire s_axi_bvalid, input wire s_axi_bready, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_arid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_araddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_arlen, input wire [3-1:0] s_axi_arsize, input wire [2-1:0] s_axi_arburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_arlock, input wire [4-1:0] s_axi_arcache, input wire [3-1:0] s_axi_arprot, input wire [4-1:0] s_axi_arregion, input wire [4-1:0] s_axi_arqos, input wire [C_AXI_ARUSER_WIDTH-1:0] s_axi_aruser, input wire s_axi_arvalid, output wire s_axi_arready, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_rid, output wire [C_AXI_DATA_WIDTH-1:0] s_axi_rdata, output wire [2-1:0] s_axi_rresp, output wire s_axi_rlast, output wire [C_AXI_RUSER_WIDTH-1:0] s_axi_ruser, output wire s_axi_rvalid, input wire s_axi_rready, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] m_axi_awid, output wire [C_AXI_ADDR_WIDTH-1:0] m_axi_awaddr, output wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] m_axi_awlen, output wire [3-1:0] m_axi_awsize, output wire [2-1:0] m_axi_awburst, output wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] m_axi_awlock, output wire [4-1:0] m_axi_awcache, output wire [3-1:0] m_axi_awprot, output wire [4-1:0] m_axi_awregion, output wire [4-1:0] m_axi_awqos, output wire [C_AXI_AWUSER_WIDTH-1:0] m_axi_awuser, output wire m_axi_awvalid, input wire m_axi_awready, // Master Interface Write Data Ports output wire [C_AXI_ID_WIDTH-1:0] m_axi_wid, output wire [C_AXI_DATA_WIDTH-1:0] m_axi_wdata, output wire [C_AXI_DATA_WIDTH/8-1:0] m_axi_wstrb, output wire m_axi_wlast, output wire [C_AXI_WUSER_WIDTH-1:0] m_axi_wuser, output wire m_axi_wvalid, input wire m_axi_wready, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] m_axi_bid, input wire [2-1:0] m_axi_bresp, input wire [C_AXI_BUSER_WIDTH-1:0] m_axi_buser, input wire m_axi_bvalid, output wire m_axi_bready, // Master Interface Read Address Port output wire [C_AXI_ID_WIDTH-1:0] m_axi_arid, output wire [C_AXI_ADDR_WIDTH-1:0] m_axi_araddr, output wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] m_axi_arlen, output wire [3-1:0] m_axi_arsize, output wire [2-1:0] m_axi_arburst, output wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] m_axi_arlock, output wire [4-1:0] m_axi_arcache, output wire [3-1:0] m_axi_arprot, output wire [4-1:0] m_axi_arregion, output wire [4-1:0] m_axi_arqos, output wire [C_AXI_ARUSER_WIDTH-1:0] m_axi_aruser, output wire m_axi_arvalid, input wire m_axi_arready, // Master Interface Read Data Ports input wire [C_AXI_ID_WIDTH-1:0] m_axi_rid, input wire [C_AXI_DATA_WIDTH-1:0] m_axi_rdata, input wire [2-1:0] m_axi_rresp, input wire m_axi_rlast, input wire [C_AXI_RUSER_WIDTH-1:0] m_axi_ruser, input wire m_axi_rvalid, output wire m_axi_rready ); wire reset; localparam C_AXI_SUPPORTS_REGION_SIGNALS = (C_AXI_PROTOCOL == 0) ? 1 : 0; `include "axi_infrastructure_v1_1_header.vh" wire [G_AXI_AWPAYLOAD_WIDTH-1:0] s_awpayload; wire [G_AXI_AWPAYLOAD_WIDTH-1:0] m_awpayload; wire [G_AXI_WPAYLOAD_WIDTH-1:0] s_wpayload; wire [G_AXI_WPAYLOAD_WIDTH-1:0] m_wpayload; wire [G_AXI_BPAYLOAD_WIDTH-1:0] s_bpayload; wire [G_AXI_BPAYLOAD_WIDTH-1:0] m_bpayload; wire [G_AXI_ARPAYLOAD_WIDTH-1:0] s_arpayload; wire [G_AXI_ARPAYLOAD_WIDTH-1:0] m_arpayload; wire [G_AXI_RPAYLOAD_WIDTH-1:0] s_rpayload; wire [G_AXI_RPAYLOAD_WIDTH-1:0] m_rpayload; assign reset = ~aresetn; axi_infrastructure_v1_1_axi2vector #( .C_AXI_PROTOCOL ( C_AXI_PROTOCOL ) , .C_AXI_ID_WIDTH ( C_AXI_ID_WIDTH ) , .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) , .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ) , .C_AXI_SUPPORTS_USER_SIGNALS ( C_AXI_SUPPORTS_USER_SIGNALS ) , .C_AXI_SUPPORTS_REGION_SIGNALS ( C_AXI_SUPPORTS_REGION_SIGNALS ) , .C_AXI_AWUSER_WIDTH ( C_AXI_AWUSER_WIDTH ) , .C_AXI_ARUSER_WIDTH ( C_AXI_ARUSER_WIDTH ) , .C_AXI_WUSER_WIDTH ( C_AXI_WUSER_WIDTH ) , .C_AXI_RUSER_WIDTH ( C_AXI_RUSER_WIDTH ) , .C_AXI_BUSER_WIDTH ( C_AXI_BUSER_WIDTH ) , .C_AWPAYLOAD_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_WPAYLOAD_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_BPAYLOAD_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_ARPAYLOAD_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_RPAYLOAD_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) ) axi_infrastructure_v1_1_axi2vector_0 ( .s_axi_awid ( s_axi_awid ) , .s_axi_awaddr ( s_axi_awaddr ) , .s_axi_awlen ( s_axi_awlen ) , .s_axi_awsize ( s_axi_awsize ) , .s_axi_awburst ( s_axi_awburst ) , .s_axi_awlock ( s_axi_awlock ) , .s_axi_awcache ( s_axi_awcache ) , .s_axi_awprot ( s_axi_awprot ) , .s_axi_awqos ( s_axi_awqos ) , .s_axi_awuser ( s_axi_awuser ) , .s_axi_awregion ( s_axi_awregion ) , .s_axi_wid ( s_axi_wid ) , .s_axi_wdata ( s_axi_wdata ) , .s_axi_wstrb ( s_axi_wstrb ) , .s_axi_wlast ( s_axi_wlast ) , .s_axi_wuser ( s_axi_wuser ) , .s_axi_bid ( s_axi_bid ) , .s_axi_bresp ( s_axi_bresp ) , .s_axi_buser ( s_axi_buser ) , .s_axi_arid ( s_axi_arid ) , .s_axi_araddr ( s_axi_araddr ) , .s_axi_arlen ( s_axi_arlen ) , .s_axi_arsize ( s_axi_arsize ) , .s_axi_arburst ( s_axi_arburst ) , .s_axi_arlock ( s_axi_arlock ) , .s_axi_arcache ( s_axi_arcache ) , .s_axi_arprot ( s_axi_arprot ) , .s_axi_arqos ( s_axi_arqos ) , .s_axi_aruser ( s_axi_aruser ) , .s_axi_arregion ( s_axi_arregion ) , .s_axi_rid ( s_axi_rid ) , .s_axi_rdata ( s_axi_rdata ) , .s_axi_rresp ( s_axi_rresp ) , .s_axi_rlast ( s_axi_rlast ) , .s_axi_ruser ( s_axi_ruser ) , .s_awpayload ( s_awpayload ) , .s_wpayload ( s_wpayload ) , .s_bpayload ( s_bpayload ) , .s_arpayload ( s_arpayload ) , .s_rpayload ( s_rpayload ) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_AW ) ) aw_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_awpayload), .S_VALID(s_axi_awvalid), .S_READY(s_axi_awready), // Master side .M_PAYLOAD_DATA(m_awpayload), .M_VALID(m_axi_awvalid), .M_READY(m_axi_awready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_W ) ) w_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_wpayload), .S_VALID(s_axi_wvalid), .S_READY(s_axi_wready), // Master side .M_PAYLOAD_DATA(m_wpayload), .M_VALID(m_axi_wvalid), .M_READY(m_axi_wready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_B ) ) b_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(m_bpayload), .S_VALID(m_axi_bvalid), .S_READY(m_axi_bready), // Master side .M_PAYLOAD_DATA(s_bpayload), .M_VALID(s_axi_bvalid), .M_READY(s_axi_bready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_AR ) ) ar_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_arpayload), .S_VALID(s_axi_arvalid), .S_READY(s_axi_arready), // Master side .M_PAYLOAD_DATA(m_arpayload), .M_VALID(m_axi_arvalid), .M_READY(m_axi_arready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_R ) ) r_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(m_rpayload), .S_VALID(m_axi_rvalid), .S_READY(m_axi_rready), // Master side .M_PAYLOAD_DATA(s_rpayload), .M_VALID(s_axi_rvalid), .M_READY(s_axi_rready) ); axi_infrastructure_v1_1_vector2axi #( .C_AXI_PROTOCOL ( C_AXI_PROTOCOL ) , .C_AXI_ID_WIDTH ( C_AXI_ID_WIDTH ) , .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) , .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ) , .C_AXI_SUPPORTS_USER_SIGNALS ( C_AXI_SUPPORTS_USER_SIGNALS ) , .C_AXI_SUPPORTS_REGION_SIGNALS ( C_AXI_SUPPORTS_REGION_SIGNALS ) , .C_AXI_AWUSER_WIDTH ( C_AXI_AWUSER_WIDTH ) , .C_AXI_ARUSER_WIDTH ( C_AXI_ARUSER_WIDTH ) , .C_AXI_WUSER_WIDTH ( C_AXI_WUSER_WIDTH ) , .C_AXI_RUSER_WIDTH ( C_AXI_RUSER_WIDTH ) , .C_AXI_BUSER_WIDTH ( C_AXI_BUSER_WIDTH ) , .C_AWPAYLOAD_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_WPAYLOAD_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_BPAYLOAD_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_ARPAYLOAD_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_RPAYLOAD_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) ) axi_infrastructure_v1_1_vector2axi_0 ( .m_awpayload ( m_awpayload ) , .m_wpayload ( m_wpayload ) , .m_bpayload ( m_bpayload ) , .m_arpayload ( m_arpayload ) , .m_rpayload ( m_rpayload ) , .m_axi_awid ( m_axi_awid ) , .m_axi_awaddr ( m_axi_awaddr ) , .m_axi_awlen ( m_axi_awlen ) , .m_axi_awsize ( m_axi_awsize ) , .m_axi_awburst ( m_axi_awburst ) , .m_axi_awlock ( m_axi_awlock ) , .m_axi_awcache ( m_axi_awcache ) , .m_axi_awprot ( m_axi_awprot ) , .m_axi_awqos ( m_axi_awqos ) , .m_axi_awuser ( m_axi_awuser ) , .m_axi_awregion ( m_axi_awregion ) , .m_axi_wid ( m_axi_wid ) , .m_axi_wdata ( m_axi_wdata ) , .m_axi_wstrb ( m_axi_wstrb ) , .m_axi_wlast ( m_axi_wlast ) , .m_axi_wuser ( m_axi_wuser ) , .m_axi_bid ( m_axi_bid ) , .m_axi_bresp ( m_axi_bresp ) , .m_axi_buser ( m_axi_buser ) , .m_axi_arid ( m_axi_arid ) , .m_axi_araddr ( m_axi_araddr ) , .m_axi_arlen ( m_axi_arlen ) , .m_axi_arsize ( m_axi_arsize ) , .m_axi_arburst ( m_axi_arburst ) , .m_axi_arlock ( m_axi_arlock ) , .m_axi_arcache ( m_axi_arcache ) , .m_axi_arprot ( m_axi_arprot ) , .m_axi_arqos ( m_axi_arqos ) , .m_axi_aruser ( m_axi_aruser ) , .m_axi_arregion ( m_axi_arregion ) , .m_axi_rid ( m_axi_rid ) , .m_axi_rdata ( m_axi_rdata ) , .m_axi_rresp ( m_axi_rresp ) , .m_axi_rlast ( m_axi_rlast ) , .m_axi_ruser ( m_axi_ruser ) ); endmodule
module. // 1 => FWD_REV = Both FWD and REV (fully-registered) // 2 => FWD = The master VALID and payload signals are registrated. // 3 => REV = The slave ready signal is registrated // 4 => SLAVE_FWD = All slave side signals and master VALID and payload are registrated. // 5 => SLAVE_RDY = All slave side signals and master READY are registrated. // 6 => INPUTS = Slave and Master side inputs are registrated. // 7 => LIGHT_WT = 1-stage pipeline register with bubble cycle, both FWD and REV pipelining parameter integer C_REG_CONFIG_AW = 0, parameter integer C_REG_CONFIG_W = 0, parameter integer C_REG_CONFIG_B = 0, parameter integer C_REG_CONFIG_AR = 0, parameter integer C_REG_CONFIG_R = 0 ) ( // System Signals input wire aclk, input wire aresetn, // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_awid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_awaddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_awlen, input wire [3-1:0] s_axi_awsize, input wire [2-1:0] s_axi_awburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_awlock, input wire [4-1:0] s_axi_awcache, input wire [3-1:0] s_axi_awprot, input wire [4-1:0] s_axi_awregion, input wire [4-1:0] s_axi_awqos, input wire [C_AXI_AWUSER_WIDTH-1:0] s_axi_awuser, input wire s_axi_awvalid, output wire s_axi_awready, // Slave Interface Write Data Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_wid, input wire [C_AXI_DATA_WIDTH-1:0] s_axi_wdata, input wire [C_AXI_DATA_WIDTH/8-1:0] s_axi_wstrb, input wire s_axi_wlast, input wire [C_AXI_WUSER_WIDTH-1:0] s_axi_wuser, input wire s_axi_wvalid, output wire s_axi_wready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_bid, output wire [2-1:0] s_axi_bresp, output wire [C_AXI_BUSER_WIDTH-1:0] s_axi_buser, output wire s_axi_bvalid, input wire s_axi_bready, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_arid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_araddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_arlen, input wire [3-1:0] s_axi_arsize, input wire [2-1:0] s_axi_arburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_arlock, input wire [4-1:0] s_axi_arcache, input wire [3-1:0] s_axi_arprot, input wire [4-1:0] s_axi_arregion, input wire [4-1:0] s_axi_arqos, input wire [C_AXI_ARUSER_WIDTH-1:0] s_axi_aruser, input wire s_axi_arvalid, output wire s_axi_arready, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_rid, output wire [C_AXI_DATA_WIDTH-1:0] s_axi_rdata, output wire [2-1:0] s_axi_rresp, output wire s_axi_rlast, output wire [C_AXI_RUSER_WIDTH-1:0] s_axi_ruser, output wire s_axi_rvalid, input wire s_axi_rready, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] m_axi_awid, output wire [C_AXI_ADDR_WIDTH-1:0] m_axi_awaddr, output wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] m_axi_awlen, output wire [3-1:0] m_axi_awsize, output wire [2-1:0] m_axi_awburst, output wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] m_axi_awlock, output wire [4-1:0] m_axi_awcache, output wire [3-1:0] m_axi_awprot, output wire [4-1:0] m_axi_awregion, output wire [4-1:0] m_axi_awqos, output wire [C_AXI_AWUSER_WIDTH-1:0] m_axi_awuser, output wire m_axi_awvalid, input wire m_axi_awready, // Master Interface Write Data Ports output wire [C_AXI_ID_WIDTH-1:0] m_axi_wid, output wire [C_AXI_DATA_WIDTH-1:0] m_axi_wdata, output wire [C_AXI_DATA_WIDTH/8-1:0] m_axi_wstrb, output wire m_axi_wlast, output wire [C_AXI_WUSER_WIDTH-1:0] m_axi_wuser, output wire m_axi_wvalid, input wire m_axi_wready, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] m_axi_bid, input wire [2-1:0] m_axi_bresp, input wire [C_AXI_BUSER_WIDTH-1:0] m_axi_buser, input wire m_axi_bvalid, output wire m_axi_bready, // Master Interface Read Address Port output wire [C_AXI_ID_WIDTH-1:0] m_axi_arid, output wire [C_AXI_ADDR_WIDTH-1:0] m_axi_araddr, output wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] m_axi_arlen, output wire [3-1:0] m_axi_arsize, output wire [2-1:0] m_axi_arburst, output wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] m_axi_arlock, output wire [4-1:0] m_axi_arcache, output wire [3-1:0] m_axi_arprot, output wire [4-1:0] m_axi_arregion, output wire [4-1:0] m_axi_arqos, output wire [C_AXI_ARUSER_WIDTH-1:0] m_axi_aruser, output wire m_axi_arvalid, input wire m_axi_arready, // Master Interface Read Data Ports input wire [C_AXI_ID_WIDTH-1:0] m_axi_rid, input wire [C_AXI_DATA_WIDTH-1:0] m_axi_rdata, input wire [2-1:0] m_axi_rresp, input wire m_axi_rlast, input wire [C_AXI_RUSER_WIDTH-1:0] m_axi_ruser, input wire m_axi_rvalid, output wire m_axi_rready ); wire reset; localparam C_AXI_SUPPORTS_REGION_SIGNALS = (C_AXI_PROTOCOL == 0) ? 1 : 0; `include "axi_infrastructure_v1_1_header.vh" wire [G_AXI_AWPAYLOAD_WIDTH-1:0] s_awpayload; wire [G_AXI_AWPAYLOAD_WIDTH-1:0] m_awpayload; wire [G_AXI_WPAYLOAD_WIDTH-1:0] s_wpayload; wire [G_AXI_WPAYLOAD_WIDTH-1:0] m_wpayload; wire [G_AXI_BPAYLOAD_WIDTH-1:0] s_bpayload; wire [G_AXI_BPAYLOAD_WIDTH-1:0] m_bpayload; wire [G_AXI_ARPAYLOAD_WIDTH-1:0] s_arpayload; wire [G_AXI_ARPAYLOAD_WIDTH-1:0] m_arpayload; wire [G_AXI_RPAYLOAD_WIDTH-1:0] s_rpayload; wire [G_AXI_RPAYLOAD_WIDTH-1:0] m_rpayload; assign reset = ~aresetn; axi_infrastructure_v1_1_axi2vector #( .C_AXI_PROTOCOL ( C_AXI_PROTOCOL ) , .C_AXI_ID_WIDTH ( C_AXI_ID_WIDTH ) , .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) , .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ) , .C_AXI_SUPPORTS_USER_SIGNALS ( C_AXI_SUPPORTS_USER_SIGNALS ) , .C_AXI_SUPPORTS_REGION_SIGNALS ( C_AXI_SUPPORTS_REGION_SIGNALS ) , .C_AXI_AWUSER_WIDTH ( C_AXI_AWUSER_WIDTH ) , .C_AXI_ARUSER_WIDTH ( C_AXI_ARUSER_WIDTH ) , .C_AXI_WUSER_WIDTH ( C_AXI_WUSER_WIDTH ) , .C_AXI_RUSER_WIDTH ( C_AXI_RUSER_WIDTH ) , .C_AXI_BUSER_WIDTH ( C_AXI_BUSER_WIDTH ) , .C_AWPAYLOAD_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_WPAYLOAD_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_BPAYLOAD_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_ARPAYLOAD_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_RPAYLOAD_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) ) axi_infrastructure_v1_1_axi2vector_0 ( .s_axi_awid ( s_axi_awid ) , .s_axi_awaddr ( s_axi_awaddr ) , .s_axi_awlen ( s_axi_awlen ) , .s_axi_awsize ( s_axi_awsize ) , .s_axi_awburst ( s_axi_awburst ) , .s_axi_awlock ( s_axi_awlock ) , .s_axi_awcache ( s_axi_awcache ) , .s_axi_awprot ( s_axi_awprot ) , .s_axi_awqos ( s_axi_awqos ) , .s_axi_awuser ( s_axi_awuser ) , .s_axi_awregion ( s_axi_awregion ) , .s_axi_wid ( s_axi_wid ) , .s_axi_wdata ( s_axi_wdata ) , .s_axi_wstrb ( s_axi_wstrb ) , .s_axi_wlast ( s_axi_wlast ) , .s_axi_wuser ( s_axi_wuser ) , .s_axi_bid ( s_axi_bid ) , .s_axi_bresp ( s_axi_bresp ) , .s_axi_buser ( s_axi_buser ) , .s_axi_arid ( s_axi_arid ) , .s_axi_araddr ( s_axi_araddr ) , .s_axi_arlen ( s_axi_arlen ) , .s_axi_arsize ( s_axi_arsize ) , .s_axi_arburst ( s_axi_arburst ) , .s_axi_arlock ( s_axi_arlock ) , .s_axi_arcache ( s_axi_arcache ) , .s_axi_arprot ( s_axi_arprot ) , .s_axi_arqos ( s_axi_arqos ) , .s_axi_aruser ( s_axi_aruser ) , .s_axi_arregion ( s_axi_arregion ) , .s_axi_rid ( s_axi_rid ) , .s_axi_rdata ( s_axi_rdata ) , .s_axi_rresp ( s_axi_rresp ) , .s_axi_rlast ( s_axi_rlast ) , .s_axi_ruser ( s_axi_ruser ) , .s_awpayload ( s_awpayload ) , .s_wpayload ( s_wpayload ) , .s_bpayload ( s_bpayload ) , .s_arpayload ( s_arpayload ) , .s_rpayload ( s_rpayload ) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_AW ) ) aw_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_awpayload), .S_VALID(s_axi_awvalid), .S_READY(s_axi_awready), // Master side .M_PAYLOAD_DATA(m_awpayload), .M_VALID(m_axi_awvalid), .M_READY(m_axi_awready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_W ) ) w_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_wpayload), .S_VALID(s_axi_wvalid), .S_READY(s_axi_wready), // Master side .M_PAYLOAD_DATA(m_wpayload), .M_VALID(m_axi_wvalid), .M_READY(m_axi_wready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_B ) ) b_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(m_bpayload), .S_VALID(m_axi_bvalid), .S_READY(m_axi_bready), // Master side .M_PAYLOAD_DATA(s_bpayload), .M_VALID(s_axi_bvalid), .M_READY(s_axi_bready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_AR ) ) ar_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(s_arpayload), .S_VALID(s_axi_arvalid), .S_READY(s_axi_arready), // Master side .M_PAYLOAD_DATA(m_arpayload), .M_VALID(m_axi_arvalid), .M_READY(m_axi_arready) ); axi_register_slice_v2_1_axic_register_slice # ( .C_FAMILY ( C_FAMILY ) , .C_DATA_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) , .C_REG_CONFIG ( C_REG_CONFIG_R ) ) r_pipe ( // System Signals .ACLK(aclk), .ARESET(reset), // Slave side .S_PAYLOAD_DATA(m_rpayload), .S_VALID(m_axi_rvalid), .S_READY(m_axi_rready), // Master side .M_PAYLOAD_DATA(s_rpayload), .M_VALID(s_axi_rvalid), .M_READY(s_axi_rready) ); axi_infrastructure_v1_1_vector2axi #( .C_AXI_PROTOCOL ( C_AXI_PROTOCOL ) , .C_AXI_ID_WIDTH ( C_AXI_ID_WIDTH ) , .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) , .C_AXI_DATA_WIDTH ( C_AXI_DATA_WIDTH ) , .C_AXI_SUPPORTS_USER_SIGNALS ( C_AXI_SUPPORTS_USER_SIGNALS ) , .C_AXI_SUPPORTS_REGION_SIGNALS ( C_AXI_SUPPORTS_REGION_SIGNALS ) , .C_AXI_AWUSER_WIDTH ( C_AXI_AWUSER_WIDTH ) , .C_AXI_ARUSER_WIDTH ( C_AXI_ARUSER_WIDTH ) , .C_AXI_WUSER_WIDTH ( C_AXI_WUSER_WIDTH ) , .C_AXI_RUSER_WIDTH ( C_AXI_RUSER_WIDTH ) , .C_AXI_BUSER_WIDTH ( C_AXI_BUSER_WIDTH ) , .C_AWPAYLOAD_WIDTH ( G_AXI_AWPAYLOAD_WIDTH ) , .C_WPAYLOAD_WIDTH ( G_AXI_WPAYLOAD_WIDTH ) , .C_BPAYLOAD_WIDTH ( G_AXI_BPAYLOAD_WIDTH ) , .C_ARPAYLOAD_WIDTH ( G_AXI_ARPAYLOAD_WIDTH ) , .C_RPAYLOAD_WIDTH ( G_AXI_RPAYLOAD_WIDTH ) ) axi_infrastructure_v1_1_vector2axi_0 ( .m_awpayload ( m_awpayload ) , .m_wpayload ( m_wpayload ) , .m_bpayload ( m_bpayload ) , .m_arpayload ( m_arpayload ) , .m_rpayload ( m_rpayload ) , .m_axi_awid ( m_axi_awid ) , .m_axi_awaddr ( m_axi_awaddr ) , .m_axi_awlen ( m_axi_awlen ) , .m_axi_awsize ( m_axi_awsize ) , .m_axi_awburst ( m_axi_awburst ) , .m_axi_awlock ( m_axi_awlock ) , .m_axi_awcache ( m_axi_awcache ) , .m_axi_awprot ( m_axi_awprot ) , .m_axi_awqos ( m_axi_awqos ) , .m_axi_awuser ( m_axi_awuser ) , .m_axi_awregion ( m_axi_awregion ) , .m_axi_wid ( m_axi_wid ) , .m_axi_wdata ( m_axi_wdata ) , .m_axi_wstrb ( m_axi_wstrb ) , .m_axi_wlast ( m_axi_wlast ) , .m_axi_wuser ( m_axi_wuser ) , .m_axi_bid ( m_axi_bid ) , .m_axi_bresp ( m_axi_bresp ) , .m_axi_buser ( m_axi_buser ) , .m_axi_arid ( m_axi_arid ) , .m_axi_araddr ( m_axi_araddr ) , .m_axi_arlen ( m_axi_arlen ) , .m_axi_arsize ( m_axi_arsize ) , .m_axi_arburst ( m_axi_arburst ) , .m_axi_arlock ( m_axi_arlock ) , .m_axi_arcache ( m_axi_arcache ) , .m_axi_arprot ( m_axi_arprot ) , .m_axi_arqos ( m_axi_arqos ) , .m_axi_aruser ( m_axi_aruser ) , .m_axi_arregion ( m_axi_arregion ) , .m_axi_rid ( m_axi_rid ) , .m_axi_rdata ( m_axi_rdata ) , .m_axi_rresp ( m_axi_rresp ) , .m_axi_rlast ( m_axi_rlast ) , .m_axi_ruser ( m_axi_ruser ) ); endmodule
module axi_infrastructure_v1_1_axi2vector # ( /////////////////////////////////////////////////////////////////////////////// // Parameter Definitions /////////////////////////////////////////////////////////////////////////////// parameter integer C_AXI_PROTOCOL = 0, parameter integer C_AXI_ID_WIDTH = 4, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH = 32, parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, parameter integer C_AXI_SUPPORTS_REGION_SIGNALS = 0, parameter integer C_AXI_AWUSER_WIDTH = 1, parameter integer C_AXI_WUSER_WIDTH = 1, parameter integer C_AXI_BUSER_WIDTH = 1, parameter integer C_AXI_ARUSER_WIDTH = 1, parameter integer C_AXI_RUSER_WIDTH = 1, parameter integer C_AWPAYLOAD_WIDTH = 61, parameter integer C_WPAYLOAD_WIDTH = 73, parameter integer C_BPAYLOAD_WIDTH = 6, parameter integer C_ARPAYLOAD_WIDTH = 61, parameter integer C_RPAYLOAD_WIDTH = 69 ) ( /////////////////////////////////////////////////////////////////////////////// // Port Declarations /////////////////////////////////////////////////////////////////////////////// // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_awid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_awaddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_awlen, input wire [3-1:0] s_axi_awsize, input wire [2-1:0] s_axi_awburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_awlock, input wire [4-1:0] s_axi_awcache, input wire [3-1:0] s_axi_awprot, input wire [4-1:0] s_axi_awregion, input wire [4-1:0] s_axi_awqos, input wire [C_AXI_AWUSER_WIDTH-1:0] s_axi_awuser, // Slave Interface Write Data Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_wid, input wire [C_AXI_DATA_WIDTH-1:0] s_axi_wdata, input wire [C_AXI_DATA_WIDTH/8-1:0] s_axi_wstrb, input wire s_axi_wlast, input wire [C_AXI_WUSER_WIDTH-1:0] s_axi_wuser, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_bid, output wire [2-1:0] s_axi_bresp, output wire [C_AXI_BUSER_WIDTH-1:0] s_axi_buser, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_arid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_araddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_arlen, input wire [3-1:0] s_axi_arsize, input wire [2-1:0] s_axi_arburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_arlock, input wire [4-1:0] s_axi_arcache, input wire [3-1:0] s_axi_arprot, input wire [4-1:0] s_axi_arregion, input wire [4-1:0] s_axi_arqos, input wire [C_AXI_ARUSER_WIDTH-1:0] s_axi_aruser, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_rid, output wire [C_AXI_DATA_WIDTH-1:0] s_axi_rdata, output wire [2-1:0] s_axi_rresp, output wire s_axi_rlast, output wire [C_AXI_RUSER_WIDTH-1:0] s_axi_ruser, // payloads output wire [C_AWPAYLOAD_WIDTH-1:0] s_awpayload, output wire [C_WPAYLOAD_WIDTH-1:0] s_wpayload, input wire [C_BPAYLOAD_WIDTH-1:0] s_bpayload, output wire [C_ARPAYLOAD_WIDTH-1:0] s_arpayload, input wire [C_RPAYLOAD_WIDTH-1:0] s_rpayload ); //////////////////////////////////////////////////////////////////////////////// // Functions //////////////////////////////////////////////////////////////////////////////// `include "axi_infrastructure_v1_1_header.vh" //////////////////////////////////////////////////////////////////////////////// // Local parameters //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // Wires/Reg declarations //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // BEGIN RTL //////////////////////////////////////////////////////////////////////////////// // AXI4, AXI4LITE, AXI3 packing assign s_awpayload[G_AXI_AWADDR_INDEX+:G_AXI_AWADDR_WIDTH] = s_axi_awaddr; assign s_awpayload[G_AXI_AWPROT_INDEX+:G_AXI_AWPROT_WIDTH] = s_axi_awprot; assign s_wpayload[G_AXI_WDATA_INDEX+:G_AXI_WDATA_WIDTH] = s_axi_wdata; assign s_wpayload[G_AXI_WSTRB_INDEX+:G_AXI_WSTRB_WIDTH] = s_axi_wstrb; assign s_axi_bresp = s_bpayload[G_AXI_BRESP_INDEX+:G_AXI_BRESP_WIDTH]; assign s_arpayload[G_AXI_ARADDR_INDEX+:G_AXI_ARADDR_WIDTH] = s_axi_araddr; assign s_arpayload[G_AXI_ARPROT_INDEX+:G_AXI_ARPROT_WIDTH] = s_axi_arprot; assign s_axi_rdata = s_rpayload[G_AXI_RDATA_INDEX+:G_AXI_RDATA_WIDTH]; assign s_axi_rresp = s_rpayload[G_AXI_RRESP_INDEX+:G_AXI_RRESP_WIDTH]; generate if (C_AXI_PROTOCOL == 0 || C_AXI_PROTOCOL == 1) begin : gen_axi4_or_axi3_packing assign s_awpayload[G_AXI_AWSIZE_INDEX+:G_AXI_AWSIZE_WIDTH] = s_axi_awsize; assign s_awpayload[G_AXI_AWBURST_INDEX+:G_AXI_AWBURST_WIDTH] = s_axi_awburst; assign s_awpayload[G_AXI_AWCACHE_INDEX+:G_AXI_AWCACHE_WIDTH] = s_axi_awcache; assign s_awpayload[G_AXI_AWLEN_INDEX+:G_AXI_AWLEN_WIDTH] = s_axi_awlen; assign s_awpayload[G_AXI_AWLOCK_INDEX+:G_AXI_AWLOCK_WIDTH] = s_axi_awlock; assign s_awpayload[G_AXI_AWID_INDEX+:G_AXI_AWID_WIDTH] = s_axi_awid; assign s_awpayload[G_AXI_AWQOS_INDEX+:G_AXI_AWQOS_WIDTH] = s_axi_awqos; assign s_wpayload[G_AXI_WLAST_INDEX+:G_AXI_WLAST_WIDTH] = s_axi_wlast; if (C_AXI_PROTOCOL == 1) begin : gen_axi3_wid_packing assign s_wpayload[G_AXI_WID_INDEX+:G_AXI_WID_WIDTH] = s_axi_wid; end else begin : gen_no_axi3_wid_packing end assign s_axi_bid = s_bpayload[G_AXI_BID_INDEX+:G_AXI_BID_WIDTH]; assign s_arpayload[G_AXI_ARSIZE_INDEX+:G_AXI_ARSIZE_WIDTH] = s_axi_arsize; assign s_arpayload[G_AXI_ARBURST_INDEX+:G_AXI_ARBURST_WIDTH] = s_axi_arburst; assign s_arpayload[G_AXI_ARCACHE_INDEX+:G_AXI_ARCACHE_WIDTH] = s_axi_arcache; assign s_arpayload[G_AXI_ARLEN_INDEX+:G_AXI_ARLEN_WIDTH] = s_axi_arlen; assign s_arpayload[G_AXI_ARLOCK_INDEX+:G_AXI_ARLOCK_WIDTH] = s_axi_arlock; assign s_arpayload[G_AXI_ARID_INDEX+:G_AXI_ARID_WIDTH] = s_axi_arid; assign s_arpayload[G_AXI_ARQOS_INDEX+:G_AXI_ARQOS_WIDTH] = s_axi_arqos; assign s_axi_rlast = s_rpayload[G_AXI_RLAST_INDEX+:G_AXI_RLAST_WIDTH]; assign s_axi_rid = s_rpayload[G_AXI_RID_INDEX+:G_AXI_RID_WIDTH]; if (C_AXI_SUPPORTS_REGION_SIGNALS == 1 && G_AXI_AWREGION_WIDTH > 0) begin : gen_region_signals assign s_awpayload[G_AXI_AWREGION_INDEX+:G_AXI_AWREGION_WIDTH] = s_axi_awregion; assign s_arpayload[G_AXI_ARREGION_INDEX+:G_AXI_ARREGION_WIDTH] = s_axi_arregion; end else begin : gen_no_region_signals end if (C_AXI_SUPPORTS_USER_SIGNALS == 1 && C_AXI_PROTOCOL != 2) begin : gen_user_signals assign s_awpayload[G_AXI_AWUSER_INDEX+:G_AXI_AWUSER_WIDTH] = s_axi_awuser; assign s_wpayload[G_AXI_WUSER_INDEX+:G_AXI_WUSER_WIDTH] = s_axi_wuser; assign s_axi_buser = s_bpayload[G_AXI_BUSER_INDEX+:G_AXI_BUSER_WIDTH]; assign s_arpayload[G_AXI_ARUSER_INDEX+:G_AXI_ARUSER_WIDTH] = s_axi_aruser; assign s_axi_ruser = s_rpayload[G_AXI_RUSER_INDEX+:G_AXI_RUSER_WIDTH]; end else begin : gen_no_user_signals assign s_axi_buser = 'b0; assign s_axi_ruser = 'b0; end end else begin : gen_axi4lite_packing assign s_axi_bid = 'b0; assign s_axi_buser = 'b0; assign s_axi_rlast = 1'b1; assign s_axi_rid = 'b0; assign s_axi_ruser = 'b0; end endgenerate endmodule
module axi_infrastructure_v1_1_axi2vector # ( /////////////////////////////////////////////////////////////////////////////// // Parameter Definitions /////////////////////////////////////////////////////////////////////////////// parameter integer C_AXI_PROTOCOL = 0, parameter integer C_AXI_ID_WIDTH = 4, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH = 32, parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, parameter integer C_AXI_SUPPORTS_REGION_SIGNALS = 0, parameter integer C_AXI_AWUSER_WIDTH = 1, parameter integer C_AXI_WUSER_WIDTH = 1, parameter integer C_AXI_BUSER_WIDTH = 1, parameter integer C_AXI_ARUSER_WIDTH = 1, parameter integer C_AXI_RUSER_WIDTH = 1, parameter integer C_AWPAYLOAD_WIDTH = 61, parameter integer C_WPAYLOAD_WIDTH = 73, parameter integer C_BPAYLOAD_WIDTH = 6, parameter integer C_ARPAYLOAD_WIDTH = 61, parameter integer C_RPAYLOAD_WIDTH = 69 ) ( /////////////////////////////////////////////////////////////////////////////// // Port Declarations /////////////////////////////////////////////////////////////////////////////// // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_awid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_awaddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_awlen, input wire [3-1:0] s_axi_awsize, input wire [2-1:0] s_axi_awburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_awlock, input wire [4-1:0] s_axi_awcache, input wire [3-1:0] s_axi_awprot, input wire [4-1:0] s_axi_awregion, input wire [4-1:0] s_axi_awqos, input wire [C_AXI_AWUSER_WIDTH-1:0] s_axi_awuser, // Slave Interface Write Data Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_wid, input wire [C_AXI_DATA_WIDTH-1:0] s_axi_wdata, input wire [C_AXI_DATA_WIDTH/8-1:0] s_axi_wstrb, input wire s_axi_wlast, input wire [C_AXI_WUSER_WIDTH-1:0] s_axi_wuser, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_bid, output wire [2-1:0] s_axi_bresp, output wire [C_AXI_BUSER_WIDTH-1:0] s_axi_buser, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] s_axi_arid, input wire [C_AXI_ADDR_WIDTH-1:0] s_axi_araddr, input wire [((C_AXI_PROTOCOL == 1) ? 4 : 8)-1:0] s_axi_arlen, input wire [3-1:0] s_axi_arsize, input wire [2-1:0] s_axi_arburst, input wire [((C_AXI_PROTOCOL == 1) ? 2 : 1)-1:0] s_axi_arlock, input wire [4-1:0] s_axi_arcache, input wire [3-1:0] s_axi_arprot, input wire [4-1:0] s_axi_arregion, input wire [4-1:0] s_axi_arqos, input wire [C_AXI_ARUSER_WIDTH-1:0] s_axi_aruser, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] s_axi_rid, output wire [C_AXI_DATA_WIDTH-1:0] s_axi_rdata, output wire [2-1:0] s_axi_rresp, output wire s_axi_rlast, output wire [C_AXI_RUSER_WIDTH-1:0] s_axi_ruser, // payloads output wire [C_AWPAYLOAD_WIDTH-1:0] s_awpayload, output wire [C_WPAYLOAD_WIDTH-1:0] s_wpayload, input wire [C_BPAYLOAD_WIDTH-1:0] s_bpayload, output wire [C_ARPAYLOAD_WIDTH-1:0] s_arpayload, input wire [C_RPAYLOAD_WIDTH-1:0] s_rpayload ); //////////////////////////////////////////////////////////////////////////////// // Functions //////////////////////////////////////////////////////////////////////////////// `include "axi_infrastructure_v1_1_header.vh" //////////////////////////////////////////////////////////////////////////////// // Local parameters //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // Wires/Reg declarations //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // BEGIN RTL //////////////////////////////////////////////////////////////////////////////// // AXI4, AXI4LITE, AXI3 packing assign s_awpayload[G_AXI_AWADDR_INDEX+:G_AXI_AWADDR_WIDTH] = s_axi_awaddr; assign s_awpayload[G_AXI_AWPROT_INDEX+:G_AXI_AWPROT_WIDTH] = s_axi_awprot; assign s_wpayload[G_AXI_WDATA_INDEX+:G_AXI_WDATA_WIDTH] = s_axi_wdata; assign s_wpayload[G_AXI_WSTRB_INDEX+:G_AXI_WSTRB_WIDTH] = s_axi_wstrb; assign s_axi_bresp = s_bpayload[G_AXI_BRESP_INDEX+:G_AXI_BRESP_WIDTH]; assign s_arpayload[G_AXI_ARADDR_INDEX+:G_AXI_ARADDR_WIDTH] = s_axi_araddr; assign s_arpayload[G_AXI_ARPROT_INDEX+:G_AXI_ARPROT_WIDTH] = s_axi_arprot; assign s_axi_rdata = s_rpayload[G_AXI_RDATA_INDEX+:G_AXI_RDATA_WIDTH]; assign s_axi_rresp = s_rpayload[G_AXI_RRESP_INDEX+:G_AXI_RRESP_WIDTH]; generate if (C_AXI_PROTOCOL == 0 || C_AXI_PROTOCOL == 1) begin : gen_axi4_or_axi3_packing assign s_awpayload[G_AXI_AWSIZE_INDEX+:G_AXI_AWSIZE_WIDTH] = s_axi_awsize; assign s_awpayload[G_AXI_AWBURST_INDEX+:G_AXI_AWBURST_WIDTH] = s_axi_awburst; assign s_awpayload[G_AXI_AWCACHE_INDEX+:G_AXI_AWCACHE_WIDTH] = s_axi_awcache; assign s_awpayload[G_AXI_AWLEN_INDEX+:G_AXI_AWLEN_WIDTH] = s_axi_awlen; assign s_awpayload[G_AXI_AWLOCK_INDEX+:G_AXI_AWLOCK_WIDTH] = s_axi_awlock; assign s_awpayload[G_AXI_AWID_INDEX+:G_AXI_AWID_WIDTH] = s_axi_awid; assign s_awpayload[G_AXI_AWQOS_INDEX+:G_AXI_AWQOS_WIDTH] = s_axi_awqos; assign s_wpayload[G_AXI_WLAST_INDEX+:G_AXI_WLAST_WIDTH] = s_axi_wlast; if (C_AXI_PROTOCOL == 1) begin : gen_axi3_wid_packing assign s_wpayload[G_AXI_WID_INDEX+:G_AXI_WID_WIDTH] = s_axi_wid; end else begin : gen_no_axi3_wid_packing end assign s_axi_bid = s_bpayload[G_AXI_BID_INDEX+:G_AXI_BID_WIDTH]; assign s_arpayload[G_AXI_ARSIZE_INDEX+:G_AXI_ARSIZE_WIDTH] = s_axi_arsize; assign s_arpayload[G_AXI_ARBURST_INDEX+:G_AXI_ARBURST_WIDTH] = s_axi_arburst; assign s_arpayload[G_AXI_ARCACHE_INDEX+:G_AXI_ARCACHE_WIDTH] = s_axi_arcache; assign s_arpayload[G_AXI_ARLEN_INDEX+:G_AXI_ARLEN_WIDTH] = s_axi_arlen; assign s_arpayload[G_AXI_ARLOCK_INDEX+:G_AXI_ARLOCK_WIDTH] = s_axi_arlock; assign s_arpayload[G_AXI_ARID_INDEX+:G_AXI_ARID_WIDTH] = s_axi_arid; assign s_arpayload[G_AXI_ARQOS_INDEX+:G_AXI_ARQOS_WIDTH] = s_axi_arqos; assign s_axi_rlast = s_rpayload[G_AXI_RLAST_INDEX+:G_AXI_RLAST_WIDTH]; assign s_axi_rid = s_rpayload[G_AXI_RID_INDEX+:G_AXI_RID_WIDTH]; if (C_AXI_SUPPORTS_REGION_SIGNALS == 1 && G_AXI_AWREGION_WIDTH > 0) begin : gen_region_signals assign s_awpayload[G_AXI_AWREGION_INDEX+:G_AXI_AWREGION_WIDTH] = s_axi_awregion; assign s_arpayload[G_AXI_ARREGION_INDEX+:G_AXI_ARREGION_WIDTH] = s_axi_arregion; end else begin : gen_no_region_signals end if (C_AXI_SUPPORTS_USER_SIGNALS == 1 && C_AXI_PROTOCOL != 2) begin : gen_user_signals assign s_awpayload[G_AXI_AWUSER_INDEX+:G_AXI_AWUSER_WIDTH] = s_axi_awuser; assign s_wpayload[G_AXI_WUSER_INDEX+:G_AXI_WUSER_WIDTH] = s_axi_wuser; assign s_axi_buser = s_bpayload[G_AXI_BUSER_INDEX+:G_AXI_BUSER_WIDTH]; assign s_arpayload[G_AXI_ARUSER_INDEX+:G_AXI_ARUSER_WIDTH] = s_axi_aruser; assign s_axi_ruser = s_rpayload[G_AXI_RUSER_INDEX+:G_AXI_RUSER_WIDTH]; end else begin : gen_no_user_signals assign s_axi_buser = 'b0; assign s_axi_ruser = 'b0; end end else begin : gen_axi4lite_packing assign s_axi_bid = 'b0; assign s_axi_buser = 'b0; assign s_axi_rlast = 1'b1; assign s_axi_rid = 'b0; assign s_axi_ruser = 'b0; end endgenerate endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module ps2_mouse ( input clk, // Clock Input input reset, // Reset Input inout ps2_clk, // PS2 Clock, Bidirectional inout ps2_dat, // PS2 Data, Bidirectional input [7:0] the_command, // Command to send to mouse input send_command, // Signal to send output command_was_sent, // Signal command finished sending output error_communication_timed_out, output [7:0] received_data, // Received data output received_data_en, // If 1 - new data has been received output start_receiving_data, output wait_for_incoming_data ); // -------------------------------------------------------------------- // Internal wires and registers Declarations // -------------------------------------------------------------------- wire ps2_clk_posedge; // Internal Wires wire ps2_clk_negedge; reg [7:0] idle_counter; // Internal Registers reg ps2_clk_reg; reg ps2_data_reg; reg last_ps2_clk; reg [2:0] ns_ps2_transceiver; // State Machine Registers reg [2:0] s_ps2_transceiver; // -------------------------------------------------------------------- // Constant Declarations // -------------------------------------------------------------------- localparam PS2_STATE_0_IDLE = 3'h0, // states PS2_STATE_1_DATA_IN = 3'h1, PS2_STATE_2_COMMAND_OUT = 3'h2, PS2_STATE_3_END_TRANSFER = 3'h3, PS2_STATE_4_END_DELAYED = 3'h4; // -------------------------------------------------------------------- // Finite State Machine(s) // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) s_ps2_transceiver <= PS2_STATE_0_IDLE; else s_ps2_transceiver <= ns_ps2_transceiver; end always @(*) begin ns_ps2_transceiver = PS2_STATE_0_IDLE; // Defaults case (s_ps2_transceiver) PS2_STATE_0_IDLE: begin if((idle_counter == 8'hFF) && (send_command == 1'b1)) ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; else if ((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_1_DATA_IN; else ns_ps2_transceiver = PS2_STATE_0_IDLE; end PS2_STATE_1_DATA_IN: begin // if((received_data_en == 1'b1) && (ps2_clk_posedge == 1'b1)) if((received_data_en == 1'b1)) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_1_DATA_IN; end PS2_STATE_2_COMMAND_OUT: begin if((command_was_sent == 1'b1) || (error_communication_timed_out == 1'b1)) ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; else ns_ps2_transceiver = PS2_STATE_2_COMMAND_OUT; end PS2_STATE_3_END_TRANSFER: begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else if((ps2_data_reg == 1'b0) && (ps2_clk_posedge == 1'b1)) ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end PS2_STATE_4_END_DELAYED: begin if(received_data_en == 1'b1) begin if(send_command == 1'b0) ns_ps2_transceiver = PS2_STATE_0_IDLE; else ns_ps2_transceiver = PS2_STATE_3_END_TRANSFER; end else ns_ps2_transceiver = PS2_STATE_4_END_DELAYED; end default: ns_ps2_transceiver = PS2_STATE_0_IDLE; endcase end // -------------------------------------------------------------------- // Sequential logic // -------------------------------------------------------------------- always @(posedge clk) begin if(reset == 1'b1) begin last_ps2_clk <= 1'b1; ps2_clk_reg <= 1'b1; ps2_data_reg <= 1'b1; end else begin last_ps2_clk <= ps2_clk_reg; ps2_clk_reg <= ps2_clk; ps2_data_reg <= ps2_dat; end end always @(posedge clk) begin if(reset == 1'b1) idle_counter <= 6'h00; else if((s_ps2_transceiver == PS2_STATE_0_IDLE) && (idle_counter != 8'hFF)) idle_counter <= idle_counter + 6'h01; else if (s_ps2_transceiver != PS2_STATE_0_IDLE) idle_counter <= 6'h00; end // -------------------------------------------------------------------- // Combinational logic // -------------------------------------------------------------------- assign ps2_clk_posedge = ((ps2_clk_reg == 1'b1) && (last_ps2_clk == 1'b0)) ? 1'b1 : 1'b0; assign ps2_clk_negedge = ((ps2_clk_reg == 1'b0) && (last_ps2_clk == 1'b1)) ? 1'b1 : 1'b0; assign start_receiving_data = (s_ps2_transceiver == PS2_STATE_1_DATA_IN); assign wait_for_incoming_data = (s_ps2_transceiver == PS2_STATE_3_END_TRANSFER); // -------------------------------------------------------------------- // Internal Modules // -------------------------------------------------------------------- ps2_mouse_cmdout mouse_cmdout ( .clk (clk), // Inputs .reset (reset), .the_command (the_command), .send_command (send_command), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_clk (ps2_clk), // Bidirectionals .ps2_dat (ps2_dat), .command_was_sent (command_was_sent), // Outputs .error_communication_timed_out (error_communication_timed_out) ); ps2_mouse_datain mouse_datain ( .clk (clk), // Inputs .reset (reset), .wait_for_incoming_data (wait_for_incoming_data), .start_receiving_data (start_receiving_data), .ps2_clk_posedge (ps2_clk_posedge), .ps2_clk_negedge (ps2_clk_negedge), .ps2_data (ps2_data_reg), .received_data (received_data), // Outputs .received_data_en (received_data_en) ); endmodule
module LZD#(parameter SWR=26, parameter EWR=5)( //#(parameter SWR=55, parameter EWR=6)( input wire clk, input wire rst, input wire load_i, input wire [SWR-1:0] Add_subt_result_i, /////////////////////////////////////////////7 output wire [EWR-1:0] Shift_Value_o ); wire [EWR-1:0] Codec_to_Reg; generate case (SWR) 26:begin Priority_Codec_32 Codec_32( .Data_Dec_i(Add_subt_result_i), .Data_Bin_o(Codec_to_Reg) ); end 55:begin Priority_Codec_64 Codec_64( .Data_Dec_i(Add_subt_result_i), .Data_Bin_o(Codec_to_Reg) ); end endcase endgenerate RegisterAdd #(.W(EWR)) Output_Reg( .clk(clk), .rst(rst), .load(load_i), .D(Codec_to_Reg), .Q(Shift_Value_o) ); endmodule
module LZD#(parameter SWR=26, parameter EWR=5)( //#(parameter SWR=55, parameter EWR=6)( input wire clk, input wire rst, input wire load_i, input wire [SWR-1:0] Add_subt_result_i, /////////////////////////////////////////////7 output wire [EWR-1:0] Shift_Value_o ); wire [EWR-1:0] Codec_to_Reg; generate case (SWR) 26:begin Priority_Codec_32 Codec_32( .Data_Dec_i(Add_subt_result_i), .Data_Bin_o(Codec_to_Reg) ); end 55:begin Priority_Codec_64 Codec_64( .Data_Dec_i(Add_subt_result_i), .Data_Bin_o(Codec_to_Reg) ); end endcase endgenerate RegisterAdd #(.W(EWR)) Output_Reg( .clk(clk), .rst(rst), .load(load_i), .D(Codec_to_Reg), .Q(Shift_Value_o) ); endmodule
module sync_signal #( parameter WIDTH=1, // width of the input and output signals parameter N=2 // depth of synchronizer )( input wire clk, input wire [WIDTH-1:0] in, output wire [WIDTH-1:0] out ); reg [WIDTH-1:0] sync_reg[N-1:0]; /* * The synchronized output is the last register in the pipeline. */ assign out = sync_reg[N-1]; integer k; always @(posedge clk) begin sync_reg[0] <= in; for (k = 1; k < N; k = k + 1) begin sync_reg[k] <= sync_reg[k-1]; end end endmodule
module sync_signal #( parameter WIDTH=1, // width of the input and output signals parameter N=2 // depth of synchronizer )( input wire clk, input wire [WIDTH-1:0] in, output wire [WIDTH-1:0] out ); reg [WIDTH-1:0] sync_reg[N-1:0]; /* * The synchronized output is the last register in the pipeline. */ assign out = sync_reg[N-1]; integer k; always @(posedge clk) begin sync_reg[0] <= in; for (k = 1; k < N; k = k + 1) begin sync_reg[k] <= sync_reg[k-1]; end end endmodule
module wdt(clk, ena, cnt, out); input clk, ena, cnt; output out; reg [6:0] timer; wire timer_top = (timer == 7'd127); reg internal_enable; wire out = internal_enable && timer_top; always @(posedge clk) begin if(ena) begin internal_enable <= 1; timer <= 0; end else if(cnt && !timer_top) timer <= timer + 7'd1; end endmodule
module wdt(clk, ena, cnt, out); input clk, ena, cnt; output out; reg [6:0] timer; wire timer_top = (timer == 7'd127); reg internal_enable; wire out = internal_enable && timer_top; always @(posedge clk) begin if(ena) begin internal_enable <= 1; timer <= 0; end else if(cnt && !timer_top) timer <= timer + 7'd1; end endmodule
module wdt(clk, ena, cnt, out); input clk, ena, cnt; output out; reg [6:0] timer; wire timer_top = (timer == 7'd127); reg internal_enable; wire out = internal_enable && timer_top; always @(posedge clk) begin if(ena) begin internal_enable <= 1; timer <= 0; end else if(cnt && !timer_top) timer <= timer + 7'd1; end endmodule
module wdt(clk, ena, cnt, out); input clk, ena, cnt; output out; reg [6:0] timer; wire timer_top = (timer == 7'd127); reg internal_enable; wire out = internal_enable && timer_top; always @(posedge clk) begin if(ena) begin internal_enable <= 1; timer <= 0; end else if(cnt && !timer_top) timer <= timer + 7'd1; end endmodule
module output wire [C_ID_WIDTH-1:0] r_arid , output wire r_push , output wire r_rlast , input wire r_full ); //////////////////////////////////////////////////////////////////////////////// // Wires/Reg declarations //////////////////////////////////////////////////////////////////////////////// wire next ; wire next_pending ; wire a_push; wire incr_burst; reg [C_ID_WIDTH-1:0] s_arid_r; //////////////////////////////////////////////////////////////////////////////// // BEGIN RTL //////////////////////////////////////////////////////////////////////////////// // Translate the AXI transaction to the MC transaction(s) axi_protocol_converter_v2_1_b2s_cmd_translator # ( .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) ) cmd_translator_0 ( .clk ( clk ) , .reset ( reset ) , .s_axaddr ( s_araddr ) , .s_axlen ( s_arlen ) , .s_axsize ( s_arsize ) , .s_axburst ( s_arburst ) , .s_axhandshake ( s_arvalid & a_push ) , .incr_burst ( incr_burst ) , .m_axaddr ( m_araddr ) , .next ( next ) , .next_pending ( next_pending ) ); axi_protocol_converter_v2_1_b2s_rd_cmd_fsm ar_cmd_fsm_0 ( .clk ( clk ) , .reset ( reset ) , .s_arready ( s_arready ) , .s_arvalid ( s_arvalid ) , .s_arlen ( s_arlen ) , .m_arvalid ( m_arvalid ) , .m_arready ( m_arready ) , .next ( next ) , .next_pending ( next_pending ) , .data_ready ( ~r_full ) , .a_push ( a_push ) , .r_push ( r_push ) ); // these signals can be moved out of this block to the top level. assign r_arid = s_arid_r; assign r_rlast = ~next_pending; always @(posedge clk) begin s_arid_r <= s_arid ; end endmodule
module output wire [C_ID_WIDTH-1:0] r_arid , output wire r_push , output wire r_rlast , input wire r_full ); //////////////////////////////////////////////////////////////////////////////// // Wires/Reg declarations //////////////////////////////////////////////////////////////////////////////// wire next ; wire next_pending ; wire a_push; wire incr_burst; reg [C_ID_WIDTH-1:0] s_arid_r; //////////////////////////////////////////////////////////////////////////////// // BEGIN RTL //////////////////////////////////////////////////////////////////////////////// // Translate the AXI transaction to the MC transaction(s) axi_protocol_converter_v2_1_b2s_cmd_translator # ( .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) ) cmd_translator_0 ( .clk ( clk ) , .reset ( reset ) , .s_axaddr ( s_araddr ) , .s_axlen ( s_arlen ) , .s_axsize ( s_arsize ) , .s_axburst ( s_arburst ) , .s_axhandshake ( s_arvalid & a_push ) , .incr_burst ( incr_burst ) , .m_axaddr ( m_araddr ) , .next ( next ) , .next_pending ( next_pending ) ); axi_protocol_converter_v2_1_b2s_rd_cmd_fsm ar_cmd_fsm_0 ( .clk ( clk ) , .reset ( reset ) , .s_arready ( s_arready ) , .s_arvalid ( s_arvalid ) , .s_arlen ( s_arlen ) , .m_arvalid ( m_arvalid ) , .m_arready ( m_arready ) , .next ( next ) , .next_pending ( next_pending ) , .data_ready ( ~r_full ) , .a_push ( a_push ) , .r_push ( r_push ) ); // these signals can be moved out of this block to the top level. assign r_arid = s_arid_r; assign r_rlast = ~next_pending; always @(posedge clk) begin s_arid_r <= s_arid ; end endmodule
module output wire [C_ID_WIDTH-1:0] r_arid , output wire r_push , output wire r_rlast , input wire r_full ); //////////////////////////////////////////////////////////////////////////////// // Wires/Reg declarations //////////////////////////////////////////////////////////////////////////////// wire next ; wire next_pending ; wire a_push; wire incr_burst; reg [C_ID_WIDTH-1:0] s_arid_r; //////////////////////////////////////////////////////////////////////////////// // BEGIN RTL //////////////////////////////////////////////////////////////////////////////// // Translate the AXI transaction to the MC transaction(s) axi_protocol_converter_v2_1_b2s_cmd_translator # ( .C_AXI_ADDR_WIDTH ( C_AXI_ADDR_WIDTH ) ) cmd_translator_0 ( .clk ( clk ) , .reset ( reset ) , .s_axaddr ( s_araddr ) , .s_axlen ( s_arlen ) , .s_axsize ( s_arsize ) , .s_axburst ( s_arburst ) , .s_axhandshake ( s_arvalid & a_push ) , .incr_burst ( incr_burst ) , .m_axaddr ( m_araddr ) , .next ( next ) , .next_pending ( next_pending ) ); axi_protocol_converter_v2_1_b2s_rd_cmd_fsm ar_cmd_fsm_0 ( .clk ( clk ) , .reset ( reset ) , .s_arready ( s_arready ) , .s_arvalid ( s_arvalid ) , .s_arlen ( s_arlen ) , .m_arvalid ( m_arvalid ) , .m_arready ( m_arready ) , .next ( next ) , .next_pending ( next_pending ) , .data_ready ( ~r_full ) , .a_push ( a_push ) , .r_push ( r_push ) ); // these signals can be moved out of this block to the top level. assign r_arid = s_arid_r; assign r_rlast = ~next_pending; always @(posedge clk) begin s_arid_r <= s_arid ; end endmodule
module wire [W-1:0] intDX; //Output of register DATA_X wire [W-1:0] intDY; //Output of register DATA_Y wire intAS; //Output of register add_subt wire gtXY; //Output for magntiude_comparator (X>Y) wire eqXY; //Output for magntiude_comparator (X=Y) wire [W-2:0] intM; //Output of MuxXY for bigger value wire [W-2:0] intm; //Output of MuxXY for small value /////////////////////////////////////////////////////////////////// RegisterAdd #(.W(W)) XRegister ( //Data X input register .clk(clk), .rst(rst), .load(load_a_i), .D(Data_X_i), .Q(intDX) ); RegisterAdd #(.W(W)) YRegister ( //Data Y input register .clk(clk), .rst(rst), .load(load_a_i), .D(Data_Y_i), .Q(intDY) ); RegisterAdd #(.W(1)) ASRegister ( //Data Add_Subtract input register .clk(clk), .rst(rst), .load(load_a_i), .D(add_subt_i), .Q(intAS) ); Comparator #(.W(W-1)) Magnitude_Comparator ( //Compare between magnitude for DATA_X and DATA_Y and select whos bigger and if there's a equality .Data_X_i(intDX[W-2:0]), .Data_Y_i(intDY[W-2:0]), .gtXY_o(gtXY), .eqXY_o(eqXY) ); xor_tri #(.W(W)) Op_verification ( //Operation between the DATA_X & Y's sign bit and the operation bit to find the real operation for ADDER/SUBTRACT .A_i(intDX[W-1]), .B_i(intDY[W-1]), .C_i(intAS), .Z_o(real_op_o) ); sgn_result result_sign_bit (//Calculate the sign bit for the final result .Add_Subt_i(intAS), .sgn_X_i(intDX[W-1]), .sgn_Y_i(intDY[W-1]), .gtXY_i(gtXY), .eqXY_i(eqXY), .sgn_result_o(sign_result) ); MultiplexTxT #(.W(W-1)) MuxXY (//Classify in the registers the bigger value (M) and the smaller value (m) .select(gtXY), .D0_i(intDX[W-2:0]), .D1_i(intDY[W-2:0]), .S0_o(intM), .S1_o(intm) ); RegisterAdd #(.W(W-1)) MRegister ( //Data_M register .clk(clk), .rst(rst), .load(load_b_i), .D(intM), .Q(DMP_o) ); RegisterAdd #(.W(W-1)) mRegister ( //Data_m register .clk(clk), .rst(rst), .load(load_b_i), .D(intm), .Q(DmP_o) ); RegisterAdd #(.W(1)) SignRegister ( .clk(clk), .rst(rst), .load(load_b_i), .D(sign_result), .Q(sign_final_result_o) ); assign zero_flag_o = real_op_o & eqXY; endmodule
module wire [W-1:0] intDX; //Output of register DATA_X wire [W-1:0] intDY; //Output of register DATA_Y wire intAS; //Output of register add_subt wire gtXY; //Output for magntiude_comparator (X>Y) wire eqXY; //Output for magntiude_comparator (X=Y) wire [W-2:0] intM; //Output of MuxXY for bigger value wire [W-2:0] intm; //Output of MuxXY for small value /////////////////////////////////////////////////////////////////// RegisterAdd #(.W(W)) XRegister ( //Data X input register .clk(clk), .rst(rst), .load(load_a_i), .D(Data_X_i), .Q(intDX) ); RegisterAdd #(.W(W)) YRegister ( //Data Y input register .clk(clk), .rst(rst), .load(load_a_i), .D(Data_Y_i), .Q(intDY) ); RegisterAdd #(.W(1)) ASRegister ( //Data Add_Subtract input register .clk(clk), .rst(rst), .load(load_a_i), .D(add_subt_i), .Q(intAS) ); Comparator #(.W(W-1)) Magnitude_Comparator ( //Compare between magnitude for DATA_X and DATA_Y and select whos bigger and if there's a equality .Data_X_i(intDX[W-2:0]), .Data_Y_i(intDY[W-2:0]), .gtXY_o(gtXY), .eqXY_o(eqXY) ); xor_tri #(.W(W)) Op_verification ( //Operation between the DATA_X & Y's sign bit and the operation bit to find the real operation for ADDER/SUBTRACT .A_i(intDX[W-1]), .B_i(intDY[W-1]), .C_i(intAS), .Z_o(real_op_o) ); sgn_result result_sign_bit (//Calculate the sign bit for the final result .Add_Subt_i(intAS), .sgn_X_i(intDX[W-1]), .sgn_Y_i(intDY[W-1]), .gtXY_i(gtXY), .eqXY_i(eqXY), .sgn_result_o(sign_result) ); MultiplexTxT #(.W(W-1)) MuxXY (//Classify in the registers the bigger value (M) and the smaller value (m) .select(gtXY), .D0_i(intDX[W-2:0]), .D1_i(intDY[W-2:0]), .S0_o(intM), .S1_o(intm) ); RegisterAdd #(.W(W-1)) MRegister ( //Data_M register .clk(clk), .rst(rst), .load(load_b_i), .D(intM), .Q(DMP_o) ); RegisterAdd #(.W(W-1)) mRegister ( //Data_m register .clk(clk), .rst(rst), .load(load_b_i), .D(intm), .Q(DmP_o) ); RegisterAdd #(.W(1)) SignRegister ( .clk(clk), .rst(rst), .load(load_b_i), .D(sign_result), .Q(sign_final_result_o) ); assign zero_flag_o = real_op_o & eqXY; endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module glbl (); parameter ROC_WIDTH = 100000; parameter TOC_WIDTH = 0; //-------- STARTUP Globals -------------- wire GSR; wire GTS; wire GWE; wire PRLD; tri1 p_up_tmp; tri (weak1, strong0) PLL_LOCKG = p_up_tmp; wire PROGB_GLBL; wire CCLKO_GLBL; wire FCSBO_GLBL; wire [3:0] DO_GLBL; wire [3:0] DI_GLBL; reg GSR_int; reg GTS_int; reg PRLD_int; //-------- JTAG Globals -------------- wire JTAG_TDO_GLBL; wire JTAG_TCK_GLBL; wire JTAG_TDI_GLBL; wire JTAG_TMS_GLBL; wire JTAG_TRST_GLBL; reg JTAG_CAPTURE_GLBL; reg JTAG_RESET_GLBL; reg JTAG_SHIFT_GLBL; reg JTAG_UPDATE_GLBL; reg JTAG_RUNTEST_GLBL; reg JTAG_SEL1_GLBL = 0; reg JTAG_SEL2_GLBL = 0 ; reg JTAG_SEL3_GLBL = 0; reg JTAG_SEL4_GLBL = 0; reg JTAG_USER_TDO1_GLBL = 1'bz; reg JTAG_USER_TDO2_GLBL = 1'bz; reg JTAG_USER_TDO3_GLBL = 1'bz; reg JTAG_USER_TDO4_GLBL = 1'bz; assign (strong1, weak0) GSR = GSR_int; assign (strong1, weak0) GTS = GTS_int; assign (weak1, weak0) PRLD = PRLD_int; initial begin GSR_int = 1'b1; PRLD_int = 1'b1; #(ROC_WIDTH) GSR_int = 1'b0; PRLD_int = 1'b0; end initial begin GTS_int = 1'b1; #(TOC_WIDTH) GTS_int = 1'b0; end endmodule
module soc_design_niosII_core_cpu_debug_slave_wrapper ( // inputs: MonDReg, break_readreg, clk, dbrk_hit0_latch, dbrk_hit1_latch, dbrk_hit2_latch, dbrk_hit3_latch, debugack, monitor_error, monitor_ready, reset_n, resetlatch, tracemem_on, tracemem_trcdata, tracemem_tw, trc_im_addr, trc_on, trc_wrap, trigbrktype, trigger_state_1, // outputs: jdo, jrst_n, st_ready_test_idle, take_action_break_a, take_action_break_b, take_action_break_c, take_action_ocimem_a, take_action_ocimem_b, take_action_tracectrl, take_no_action_break_a, take_no_action_break_b, take_no_action_break_c, take_no_action_ocimem_a ) ; output [ 37: 0] jdo; output jrst_n; output st_ready_test_idle; output take_action_break_a; output take_action_break_b; output take_action_break_c; output take_action_ocimem_a; output take_action_ocimem_b; output take_action_tracectrl; output take_no_action_break_a; output take_no_action_break_b; output take_no_action_break_c; output take_no_action_ocimem_a; input [ 31: 0] MonDReg; input [ 31: 0] break_readreg; input clk; input dbrk_hit0_latch; input dbrk_hit1_latch; input dbrk_hit2_latch; input dbrk_hit3_latch; input debugack; input monitor_error; input monitor_ready; input reset_n; input resetlatch; input tracemem_on; input [ 35: 0] tracemem_trcdata; input tracemem_tw; input [ 6: 0] trc_im_addr; input trc_on; input trc_wrap; input trigbrktype; input trigger_state_1; wire [ 37: 0] jdo; wire jrst_n; wire [ 37: 0] sr; wire st_ready_test_idle; wire take_action_break_a; wire take_action_break_b; wire take_action_break_c; wire take_action_ocimem_a; wire take_action_ocimem_b; wire take_action_tracectrl; wire take_no_action_break_a; wire take_no_action_break_b; wire take_no_action_break_c; wire take_no_action_ocimem_a; wire vji_cdr; wire [ 1: 0] vji_ir_in; wire [ 1: 0] vji_ir_out; wire vji_rti; wire vji_sdr; wire vji_tck; wire vji_tdi; wire vji_tdo; wire vji_udr; wire vji_uir; //Change the sld_virtual_jtag_basic's defparams to //switch between a regular Nios II or an internally embedded Nios II. //For a regular Nios II, sld_mfg_id = 70, sld_type_id = 34. //For an internally embedded Nios II, slf_mfg_id = 110, sld_type_id = 135. soc_design_niosII_core_cpu_debug_slave_tck the_soc_design_niosII_core_cpu_debug_slave_tck ( .MonDReg (MonDReg), .break_readreg (break_readreg), .dbrk_hit0_latch (dbrk_hit0_latch), .dbrk_hit1_latch (dbrk_hit1_latch), .dbrk_hit2_latch (dbrk_hit2_latch), .dbrk_hit3_latch (dbrk_hit3_latch), .debugack (debugack), .ir_in (vji_ir_in), .ir_out (vji_ir_out), .jrst_n (jrst_n), .jtag_state_rti (vji_rti), .monitor_error (monitor_error), .monitor_ready (monitor_ready), .reset_n (reset_n), .resetlatch (resetlatch), .sr (sr), .st_ready_test_idle (st_ready_test_idle), .tck (vji_tck), .tdi (vji_tdi), .tdo (vji_tdo), .tracemem_on (tracemem_on), .tracemem_trcdata (tracemem_trcdata), .tracemem_tw (tracemem_tw), .trc_im_addr (trc_im_addr), .trc_on (trc_on), .trc_wrap (trc_wrap), .trigbrktype (trigbrktype), .trigger_state_1 (trigger_state_1), .vs_cdr (vji_cdr), .vs_sdr (vji_sdr), .vs_uir (vji_uir) ); soc_design_niosII_core_cpu_debug_slave_sysclk the_soc_design_niosII_core_cpu_debug_slave_sysclk ( .clk (clk), .ir_in (vji_ir_in), .jdo (jdo), .sr (sr), .take_action_break_a (take_action_break_a), .take_action_break_b (take_action_break_b), .take_action_break_c (take_action_break_c), .take_action_ocimem_a (take_action_ocimem_a), .take_action_ocimem_b (take_action_ocimem_b), .take_action_tracectrl (take_action_tracectrl), .take_no_action_break_a (take_no_action_break_a), .take_no_action_break_b (take_no_action_break_b), .take_no_action_break_c (take_no_action_break_c), .take_no_action_ocimem_a (take_no_action_ocimem_a), .vs_udr (vji_udr), .vs_uir (vji_uir) ); //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS assign vji_tck = 1'b0; assign vji_tdi = 1'b0; assign vji_sdr = 1'b0; assign vji_cdr = 1'b0; assign vji_rti = 1'b0; assign vji_uir = 1'b0; assign vji_udr = 1'b0; assign vji_ir_in = 2'b0; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // sld_virtual_jtag_basic soc_design_niosII_core_cpu_debug_slave_phy // ( // .ir_in (vji_ir_in), // .ir_out (vji_ir_out), // .jtag_state_rti (vji_rti), // .tck (vji_tck), // .tdi (vji_tdi), // .tdo (vji_tdo), // .virtual_state_cdr (vji_cdr), // .virtual_state_sdr (vji_sdr), // .virtual_state_udr (vji_udr), // .virtual_state_uir (vji_uir) // ); // // defparam soc_design_niosII_core_cpu_debug_slave_phy.sld_auto_instance_index = "YES", // soc_design_niosII_core_cpu_debug_slave_phy.sld_instance_index = 0, // soc_design_niosII_core_cpu_debug_slave_phy.sld_ir_width = 2, // soc_design_niosII_core_cpu_debug_slave_phy.sld_mfg_id = 70, // soc_design_niosII_core_cpu_debug_slave_phy.sld_sim_action = "", // soc_design_niosII_core_cpu_debug_slave_phy.sld_sim_n_scan = 0, // soc_design_niosII_core_cpu_debug_slave_phy.sld_sim_total_length = 0, // soc_design_niosII_core_cpu_debug_slave_phy.sld_type_id = 34, // soc_design_niosII_core_cpu_debug_slave_phy.sld_version = 3; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG_sim_scfifo_w ( // inputs: clk, fifo_wdata, fifo_wr, // outputs: fifo_FF, r_dat, wfifo_empty, wfifo_used ) ; output fifo_FF; output [ 7: 0] r_dat; output wfifo_empty; output [ 5: 0] wfifo_used; input clk; input [ 7: 0] fifo_wdata; input fifo_wr; wire fifo_FF; wire [ 7: 0] r_dat; wire wfifo_empty; wire [ 5: 0] wfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS always @(posedge clk) begin if (fifo_wr) $write("%c", fifo_wdata); end assign wfifo_used = {6{1'b0}}; assign r_dat = {8{1'b0}}; assign fifo_FF = 1'b0; assign wfifo_empty = 1'b1; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on endmodule
module soc_design_JTAG_scfifo_w ( // inputs: clk, fifo_clear, fifo_wdata, fifo_wr, rd_wfifo, // outputs: fifo_FF, r_dat, wfifo_empty, wfifo_used ) ; output fifo_FF; output [ 7: 0] r_dat; output wfifo_empty; output [ 5: 0] wfifo_used; input clk; input fifo_clear; input [ 7: 0] fifo_wdata; input fifo_wr; input rd_wfifo; wire fifo_FF; wire [ 7: 0] r_dat; wire wfifo_empty; wire [ 5: 0] wfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS soc_design_JTAG_sim_scfifo_w the_soc_design_JTAG_sim_scfifo_w ( .clk (clk), .fifo_FF (fifo_FF), .fifo_wdata (fifo_wdata), .fifo_wr (fifo_wr), .r_dat (r_dat), .wfifo_empty (wfifo_empty), .wfifo_used (wfifo_used) ); //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // scfifo wfifo // ( // .aclr (fifo_clear), // .clock (clk), // .data (fifo_wdata), // .empty (wfifo_empty), // .full (fifo_FF), // .q (r_dat), // .rdreq (rd_wfifo), // .usedw (wfifo_used), // .wrreq (fifo_wr) // ); // // defparam wfifo.lpm_hint = "RAM_BLOCK_TYPE=AUTO", // wfifo.lpm_numwords = 64, // wfifo.lpm_showahead = "OFF", // wfifo.lpm_type = "scfifo", // wfifo.lpm_width = 8, // wfifo.lpm_widthu = 6, // wfifo.overflow_checking = "OFF", // wfifo.underflow_checking = "OFF", // wfifo.use_eab = "ON"; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG_sim_scfifo_r ( // inputs: clk, fifo_rd, rst_n, // outputs: fifo_EF, fifo_rdata, rfifo_full, rfifo_used ) ; output fifo_EF; output [ 7: 0] fifo_rdata; output rfifo_full; output [ 5: 0] rfifo_used; input clk; input fifo_rd; input rst_n; reg [ 31: 0] bytes_left; wire fifo_EF; reg fifo_rd_d; wire [ 7: 0] fifo_rdata; wire new_rom; wire [ 31: 0] num_bytes; wire [ 6: 0] rfifo_entries; wire rfifo_full; wire [ 5: 0] rfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS // Generate rfifo_entries for simulation always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin bytes_left <= 32'h0; fifo_rd_d <= 1'b0; end else begin fifo_rd_d <= fifo_rd; // decrement on read if (fifo_rd_d) bytes_left <= bytes_left - 1'b1; // catch new contents if (new_rom) bytes_left <= num_bytes; end end assign fifo_EF = bytes_left == 32'b0; assign rfifo_full = bytes_left > 7'h40; assign rfifo_entries = (rfifo_full) ? 7'h40 : bytes_left; assign rfifo_used = rfifo_entries[5 : 0]; assign new_rom = 1'b0; assign num_bytes = 32'b0; assign fifo_rdata = 8'b0; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on endmodule
module soc_design_JTAG_scfifo_r ( // inputs: clk, fifo_clear, fifo_rd, rst_n, t_dat, wr_rfifo, // outputs: fifo_EF, fifo_rdata, rfifo_full, rfifo_used ) ; output fifo_EF; output [ 7: 0] fifo_rdata; output rfifo_full; output [ 5: 0] rfifo_used; input clk; input fifo_clear; input fifo_rd; input rst_n; input [ 7: 0] t_dat; input wr_rfifo; wire fifo_EF; wire [ 7: 0] fifo_rdata; wire rfifo_full; wire [ 5: 0] rfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS soc_design_JTAG_sim_scfifo_r the_soc_design_JTAG_sim_scfifo_r ( .clk (clk), .fifo_EF (fifo_EF), .fifo_rd (fifo_rd), .fifo_rdata (fifo_rdata), .rfifo_full (rfifo_full), .rfifo_used (rfifo_used), .rst_n (rst_n) ); //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // scfifo rfifo // ( // .aclr (fifo_clear), // .clock (clk), // .data (t_dat), // .empty (fifo_EF), // .full (rfifo_full), // .q (fifo_rdata), // .rdreq (fifo_rd), // .usedw (rfifo_used), // .wrreq (wr_rfifo) // ); // // defparam rfifo.lpm_hint = "RAM_BLOCK_TYPE=AUTO", // rfifo.lpm_numwords = 64, // rfifo.lpm_showahead = "OFF", // rfifo.lpm_type = "scfifo", // rfifo.lpm_width = 8, // rfifo.lpm_widthu = 6, // rfifo.overflow_checking = "OFF", // rfifo.underflow_checking = "OFF", // rfifo.use_eab = "ON"; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG ( // inputs: av_address, av_chipselect, av_read_n, av_write_n, av_writedata, clk, rst_n, // outputs: av_irq, av_readdata, av_waitrequest, dataavailable, readyfordata ) /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"R101,C106,D101,D103\"" */ ; output av_irq; output [ 31: 0] av_readdata; output av_waitrequest; output dataavailable; output readyfordata; input av_address; input av_chipselect; input av_read_n; input av_write_n; input [ 31: 0] av_writedata; input clk; input rst_n; reg ac; wire activity; wire av_irq; wire [ 31: 0] av_readdata; reg av_waitrequest; reg dataavailable; reg fifo_AE; reg fifo_AF; wire fifo_EF; wire fifo_FF; wire fifo_clear; wire fifo_rd; wire [ 7: 0] fifo_rdata; wire [ 7: 0] fifo_wdata; reg fifo_wr; reg ien_AE; reg ien_AF; wire ipen_AE; wire ipen_AF; reg pause_irq; wire [ 7: 0] r_dat; wire r_ena; reg r_val; wire rd_wfifo; reg read_0; reg readyfordata; wire rfifo_full; wire [ 5: 0] rfifo_used; reg rvalid; reg sim_r_ena; reg sim_t_dat; reg sim_t_ena; reg sim_t_pause; wire [ 7: 0] t_dat; reg t_dav; wire t_ena; wire t_pause; wire wfifo_empty; wire [ 5: 0] wfifo_used; reg woverflow; wire wr_rfifo; //avalon_jtag_slave, which is an e_avalon_slave assign rd_wfifo = r_ena & ~wfifo_empty; assign wr_rfifo = t_ena & ~rfifo_full; assign fifo_clear = ~rst_n; soc_design_JTAG_scfifo_w the_soc_design_JTAG_scfifo_w ( .clk (clk), .fifo_FF (fifo_FF), .fifo_clear (fifo_clear), .fifo_wdata (fifo_wdata), .fifo_wr (fifo_wr), .r_dat (r_dat), .rd_wfifo (rd_wfifo), .wfifo_empty (wfifo_empty), .wfifo_used (wfifo_used) ); soc_design_JTAG_scfifo_r the_soc_design_JTAG_scfifo_r ( .clk (clk), .fifo_EF (fifo_EF), .fifo_clear (fifo_clear), .fifo_rd (fifo_rd), .fifo_rdata (fifo_rdata), .rfifo_full (rfifo_full), .rfifo_used (rfifo_used), .rst_n (rst_n), .t_dat (t_dat), .wr_rfifo (wr_rfifo) ); assign ipen_AE = ien_AE & fifo_AE; assign ipen_AF = ien_AF & (pause_irq | fifo_AF); assign av_irq = ipen_AE | ipen_AF; assign activity = t_pause | t_ena; always @(posedge clk or negedge rst_n) begin if (rst_n == 0) pause_irq <= 1'b0; else // only if fifo is not empty... if (t_pause & ~fifo_EF) pause_irq <= 1'b1; else if (read_0) pause_irq <= 1'b0; end always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin r_val <= 1'b0; t_dav <= 1'b1; end else begin r_val <= r_ena & ~wfifo_empty; t_dav <= ~rfifo_full; end end always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin fifo_AE <= 1'b0; fifo_AF <= 1'b0; fifo_wr <= 1'b0; rvalid <= 1'b0; read_0 <= 1'b0; ien_AE <= 1'b0; ien_AF <= 1'b0; ac <= 1'b0; woverflow <= 1'b0; av_waitrequest <= 1'b1; end else begin fifo_AE <= {fifo_FF,wfifo_used} <= 8; fifo_AF <= (7'h40 - {rfifo_full,rfifo_used}) <= 8; fifo_wr <= 1'b0; read_0 <= 1'b0; av_waitrequest <= ~(av_chipselect & (~av_write_n | ~av_read_n) & av_waitrequest); if (activity) ac <= 1'b1; // write if (av_chipselect & ~av_write_n & av_waitrequest) // addr 1 is control; addr 0 is data if (av_address) begin ien_AF <= av_writedata[0]; ien_AE <= av_writedata[1]; if (av_writedata[10] & ~activity) ac <= 1'b0; end else begin fifo_wr <= ~fifo_FF; woverflow <= fifo_FF; end // read if (av_chipselect & ~av_read_n & av_waitrequest) begin // addr 1 is interrupt; addr 0 is data if (~av_address) rvalid <= ~fifo_EF; read_0 <= ~av_address; end end end assign fifo_wdata = av_writedata[7 : 0]; assign fifo_rd = (av_chipselect & ~av_read_n & av_waitrequest & ~av_address) ? ~fifo_EF : 1'b0; assign av_readdata = read_0 ? { {9{1'b0}},rfifo_full,rfifo_used,rvalid,woverflow,~fifo_FF,~fifo_EF,1'b0,ac,ipen_AE,ipen_AF,fifo_rdata } : { {9{1'b0}},(7'h40 - {fifo_FF,wfifo_used}),rvalid,woverflow,~fifo_FF,~fifo_EF,1'b0,ac,ipen_AE,ipen_AF,{6{1'b0}},ien_AE,ien_AF }; always @(posedge clk or negedge rst_n) begin if (rst_n == 0) readyfordata <= 0; else readyfordata <= ~fifo_FF; end //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS // Tie off Atlantic Interface signals not used for simulation always @(posedge clk) begin sim_t_pause <= 1'b0; sim_t_ena <= 1'b0; sim_t_dat <= t_dav ? r_dat : {8{r_val}}; sim_r_ena <= 1'b0; end assign r_ena = sim_r_ena; assign t_ena = sim_t_ena; assign t_dat = sim_t_dat; assign t_pause = sim_t_pause; always @(fifo_EF) begin dataavailable = ~fifo_EF; end //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // alt_jtag_atlantic soc_design_JTAG_alt_jtag_atlantic // ( // .clk (clk), // .r_dat (r_dat), // .r_ena (r_ena), // .r_val (r_val), // .rst_n (rst_n), // .t_dat (t_dat), // .t_dav (t_dav), // .t_ena (t_ena), // .t_pause (t_pause) // ); // // defparam soc_design_JTAG_alt_jtag_atlantic.INSTANCE_ID = 0, // soc_design_JTAG_alt_jtag_atlantic.LOG2_RXFIFO_DEPTH = 6, // soc_design_JTAG_alt_jtag_atlantic.LOG2_TXFIFO_DEPTH = 6, // soc_design_JTAG_alt_jtag_atlantic.SLD_AUTO_INSTANCE_INDEX = "YES"; // // always @(posedge clk or negedge rst_n) // begin // if (rst_n == 0) // dataavailable <= 0; // else // dataavailable <= ~fifo_EF; // end // // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG_sim_scfifo_w ( // inputs: clk, fifo_wdata, fifo_wr, // outputs: fifo_FF, r_dat, wfifo_empty, wfifo_used ) ; output fifo_FF; output [ 7: 0] r_dat; output wfifo_empty; output [ 5: 0] wfifo_used; input clk; input [ 7: 0] fifo_wdata; input fifo_wr; wire fifo_FF; wire [ 7: 0] r_dat; wire wfifo_empty; wire [ 5: 0] wfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS always @(posedge clk) begin if (fifo_wr) $write("%c", fifo_wdata); end assign wfifo_used = {6{1'b0}}; assign r_dat = {8{1'b0}}; assign fifo_FF = 1'b0; assign wfifo_empty = 1'b1; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on endmodule
module soc_design_JTAG_scfifo_w ( // inputs: clk, fifo_clear, fifo_wdata, fifo_wr, rd_wfifo, // outputs: fifo_FF, r_dat, wfifo_empty, wfifo_used ) ; output fifo_FF; output [ 7: 0] r_dat; output wfifo_empty; output [ 5: 0] wfifo_used; input clk; input fifo_clear; input [ 7: 0] fifo_wdata; input fifo_wr; input rd_wfifo; wire fifo_FF; wire [ 7: 0] r_dat; wire wfifo_empty; wire [ 5: 0] wfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS soc_design_JTAG_sim_scfifo_w the_soc_design_JTAG_sim_scfifo_w ( .clk (clk), .fifo_FF (fifo_FF), .fifo_wdata (fifo_wdata), .fifo_wr (fifo_wr), .r_dat (r_dat), .wfifo_empty (wfifo_empty), .wfifo_used (wfifo_used) ); //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // scfifo wfifo // ( // .aclr (fifo_clear), // .clock (clk), // .data (fifo_wdata), // .empty (wfifo_empty), // .full (fifo_FF), // .q (r_dat), // .rdreq (rd_wfifo), // .usedw (wfifo_used), // .wrreq (fifo_wr) // ); // // defparam wfifo.lpm_hint = "RAM_BLOCK_TYPE=AUTO", // wfifo.lpm_numwords = 64, // wfifo.lpm_showahead = "OFF", // wfifo.lpm_type = "scfifo", // wfifo.lpm_width = 8, // wfifo.lpm_widthu = 6, // wfifo.overflow_checking = "OFF", // wfifo.underflow_checking = "OFF", // wfifo.use_eab = "ON"; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG_sim_scfifo_r ( // inputs: clk, fifo_rd, rst_n, // outputs: fifo_EF, fifo_rdata, rfifo_full, rfifo_used ) ; output fifo_EF; output [ 7: 0] fifo_rdata; output rfifo_full; output [ 5: 0] rfifo_used; input clk; input fifo_rd; input rst_n; reg [ 31: 0] bytes_left; wire fifo_EF; reg fifo_rd_d; wire [ 7: 0] fifo_rdata; wire new_rom; wire [ 31: 0] num_bytes; wire [ 6: 0] rfifo_entries; wire rfifo_full; wire [ 5: 0] rfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS // Generate rfifo_entries for simulation always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin bytes_left <= 32'h0; fifo_rd_d <= 1'b0; end else begin fifo_rd_d <= fifo_rd; // decrement on read if (fifo_rd_d) bytes_left <= bytes_left - 1'b1; // catch new contents if (new_rom) bytes_left <= num_bytes; end end assign fifo_EF = bytes_left == 32'b0; assign rfifo_full = bytes_left > 7'h40; assign rfifo_entries = (rfifo_full) ? 7'h40 : bytes_left; assign rfifo_used = rfifo_entries[5 : 0]; assign new_rom = 1'b0; assign num_bytes = 32'b0; assign fifo_rdata = 8'b0; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on endmodule
module soc_design_JTAG_scfifo_r ( // inputs: clk, fifo_clear, fifo_rd, rst_n, t_dat, wr_rfifo, // outputs: fifo_EF, fifo_rdata, rfifo_full, rfifo_used ) ; output fifo_EF; output [ 7: 0] fifo_rdata; output rfifo_full; output [ 5: 0] rfifo_used; input clk; input fifo_clear; input fifo_rd; input rst_n; input [ 7: 0] t_dat; input wr_rfifo; wire fifo_EF; wire [ 7: 0] fifo_rdata; wire rfifo_full; wire [ 5: 0] rfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS soc_design_JTAG_sim_scfifo_r the_soc_design_JTAG_sim_scfifo_r ( .clk (clk), .fifo_EF (fifo_EF), .fifo_rd (fifo_rd), .fifo_rdata (fifo_rdata), .rfifo_full (rfifo_full), .rfifo_used (rfifo_used), .rst_n (rst_n) ); //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // scfifo rfifo // ( // .aclr (fifo_clear), // .clock (clk), // .data (t_dat), // .empty (fifo_EF), // .full (rfifo_full), // .q (fifo_rdata), // .rdreq (fifo_rd), // .usedw (rfifo_used), // .wrreq (wr_rfifo) // ); // // defparam rfifo.lpm_hint = "RAM_BLOCK_TYPE=AUTO", // rfifo.lpm_numwords = 64, // rfifo.lpm_showahead = "OFF", // rfifo.lpm_type = "scfifo", // rfifo.lpm_width = 8, // rfifo.lpm_widthu = 6, // rfifo.overflow_checking = "OFF", // rfifo.underflow_checking = "OFF", // rfifo.use_eab = "ON"; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG ( // inputs: av_address, av_chipselect, av_read_n, av_write_n, av_writedata, clk, rst_n, // outputs: av_irq, av_readdata, av_waitrequest, dataavailable, readyfordata ) /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"R101,C106,D101,D103\"" */ ; output av_irq; output [ 31: 0] av_readdata; output av_waitrequest; output dataavailable; output readyfordata; input av_address; input av_chipselect; input av_read_n; input av_write_n; input [ 31: 0] av_writedata; input clk; input rst_n; reg ac; wire activity; wire av_irq; wire [ 31: 0] av_readdata; reg av_waitrequest; reg dataavailable; reg fifo_AE; reg fifo_AF; wire fifo_EF; wire fifo_FF; wire fifo_clear; wire fifo_rd; wire [ 7: 0] fifo_rdata; wire [ 7: 0] fifo_wdata; reg fifo_wr; reg ien_AE; reg ien_AF; wire ipen_AE; wire ipen_AF; reg pause_irq; wire [ 7: 0] r_dat; wire r_ena; reg r_val; wire rd_wfifo; reg read_0; reg readyfordata; wire rfifo_full; wire [ 5: 0] rfifo_used; reg rvalid; reg sim_r_ena; reg sim_t_dat; reg sim_t_ena; reg sim_t_pause; wire [ 7: 0] t_dat; reg t_dav; wire t_ena; wire t_pause; wire wfifo_empty; wire [ 5: 0] wfifo_used; reg woverflow; wire wr_rfifo; //avalon_jtag_slave, which is an e_avalon_slave assign rd_wfifo = r_ena & ~wfifo_empty; assign wr_rfifo = t_ena & ~rfifo_full; assign fifo_clear = ~rst_n; soc_design_JTAG_scfifo_w the_soc_design_JTAG_scfifo_w ( .clk (clk), .fifo_FF (fifo_FF), .fifo_clear (fifo_clear), .fifo_wdata (fifo_wdata), .fifo_wr (fifo_wr), .r_dat (r_dat), .rd_wfifo (rd_wfifo), .wfifo_empty (wfifo_empty), .wfifo_used (wfifo_used) ); soc_design_JTAG_scfifo_r the_soc_design_JTAG_scfifo_r ( .clk (clk), .fifo_EF (fifo_EF), .fifo_clear (fifo_clear), .fifo_rd (fifo_rd), .fifo_rdata (fifo_rdata), .rfifo_full (rfifo_full), .rfifo_used (rfifo_used), .rst_n (rst_n), .t_dat (t_dat), .wr_rfifo (wr_rfifo) ); assign ipen_AE = ien_AE & fifo_AE; assign ipen_AF = ien_AF & (pause_irq | fifo_AF); assign av_irq = ipen_AE | ipen_AF; assign activity = t_pause | t_ena; always @(posedge clk or negedge rst_n) begin if (rst_n == 0) pause_irq <= 1'b0; else // only if fifo is not empty... if (t_pause & ~fifo_EF) pause_irq <= 1'b1; else if (read_0) pause_irq <= 1'b0; end always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin r_val <= 1'b0; t_dav <= 1'b1; end else begin r_val <= r_ena & ~wfifo_empty; t_dav <= ~rfifo_full; end end always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin fifo_AE <= 1'b0; fifo_AF <= 1'b0; fifo_wr <= 1'b0; rvalid <= 1'b0; read_0 <= 1'b0; ien_AE <= 1'b0; ien_AF <= 1'b0; ac <= 1'b0; woverflow <= 1'b0; av_waitrequest <= 1'b1; end else begin fifo_AE <= {fifo_FF,wfifo_used} <= 8; fifo_AF <= (7'h40 - {rfifo_full,rfifo_used}) <= 8; fifo_wr <= 1'b0; read_0 <= 1'b0; av_waitrequest <= ~(av_chipselect & (~av_write_n | ~av_read_n) & av_waitrequest); if (activity) ac <= 1'b1; // write if (av_chipselect & ~av_write_n & av_waitrequest) // addr 1 is control; addr 0 is data if (av_address) begin ien_AF <= av_writedata[0]; ien_AE <= av_writedata[1]; if (av_writedata[10] & ~activity) ac <= 1'b0; end else begin fifo_wr <= ~fifo_FF; woverflow <= fifo_FF; end // read if (av_chipselect & ~av_read_n & av_waitrequest) begin // addr 1 is interrupt; addr 0 is data if (~av_address) rvalid <= ~fifo_EF; read_0 <= ~av_address; end end end assign fifo_wdata = av_writedata[7 : 0]; assign fifo_rd = (av_chipselect & ~av_read_n & av_waitrequest & ~av_address) ? ~fifo_EF : 1'b0; assign av_readdata = read_0 ? { {9{1'b0}},rfifo_full,rfifo_used,rvalid,woverflow,~fifo_FF,~fifo_EF,1'b0,ac,ipen_AE,ipen_AF,fifo_rdata } : { {9{1'b0}},(7'h40 - {fifo_FF,wfifo_used}),rvalid,woverflow,~fifo_FF,~fifo_EF,1'b0,ac,ipen_AE,ipen_AF,{6{1'b0}},ien_AE,ien_AF }; always @(posedge clk or negedge rst_n) begin if (rst_n == 0) readyfordata <= 0; else readyfordata <= ~fifo_FF; end //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS // Tie off Atlantic Interface signals not used for simulation always @(posedge clk) begin sim_t_pause <= 1'b0; sim_t_ena <= 1'b0; sim_t_dat <= t_dav ? r_dat : {8{r_val}}; sim_r_ena <= 1'b0; end assign r_ena = sim_r_ena; assign t_ena = sim_t_ena; assign t_dat = sim_t_dat; assign t_pause = sim_t_pause; always @(fifo_EF) begin dataavailable = ~fifo_EF; end //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // alt_jtag_atlantic soc_design_JTAG_alt_jtag_atlantic // ( // .clk (clk), // .r_dat (r_dat), // .r_ena (r_ena), // .r_val (r_val), // .rst_n (rst_n), // .t_dat (t_dat), // .t_dav (t_dav), // .t_ena (t_ena), // .t_pause (t_pause) // ); // // defparam soc_design_JTAG_alt_jtag_atlantic.INSTANCE_ID = 0, // soc_design_JTAG_alt_jtag_atlantic.LOG2_RXFIFO_DEPTH = 6, // soc_design_JTAG_alt_jtag_atlantic.LOG2_TXFIFO_DEPTH = 6, // soc_design_JTAG_alt_jtag_atlantic.SLD_AUTO_INSTANCE_INDEX = "YES"; // // always @(posedge clk or negedge rst_n) // begin // if (rst_n == 0) // dataavailable <= 0; // else // dataavailable <= ~fifo_EF; // end // // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG_sim_scfifo_w ( // inputs: clk, fifo_wdata, fifo_wr, // outputs: fifo_FF, r_dat, wfifo_empty, wfifo_used ) ; output fifo_FF; output [ 7: 0] r_dat; output wfifo_empty; output [ 5: 0] wfifo_used; input clk; input [ 7: 0] fifo_wdata; input fifo_wr; wire fifo_FF; wire [ 7: 0] r_dat; wire wfifo_empty; wire [ 5: 0] wfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS always @(posedge clk) begin if (fifo_wr) $write("%c", fifo_wdata); end assign wfifo_used = {6{1'b0}}; assign r_dat = {8{1'b0}}; assign fifo_FF = 1'b0; assign wfifo_empty = 1'b1; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on endmodule
module soc_design_JTAG_scfifo_w ( // inputs: clk, fifo_clear, fifo_wdata, fifo_wr, rd_wfifo, // outputs: fifo_FF, r_dat, wfifo_empty, wfifo_used ) ; output fifo_FF; output [ 7: 0] r_dat; output wfifo_empty; output [ 5: 0] wfifo_used; input clk; input fifo_clear; input [ 7: 0] fifo_wdata; input fifo_wr; input rd_wfifo; wire fifo_FF; wire [ 7: 0] r_dat; wire wfifo_empty; wire [ 5: 0] wfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS soc_design_JTAG_sim_scfifo_w the_soc_design_JTAG_sim_scfifo_w ( .clk (clk), .fifo_FF (fifo_FF), .fifo_wdata (fifo_wdata), .fifo_wr (fifo_wr), .r_dat (r_dat), .wfifo_empty (wfifo_empty), .wfifo_used (wfifo_used) ); //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // scfifo wfifo // ( // .aclr (fifo_clear), // .clock (clk), // .data (fifo_wdata), // .empty (wfifo_empty), // .full (fifo_FF), // .q (r_dat), // .rdreq (rd_wfifo), // .usedw (wfifo_used), // .wrreq (fifo_wr) // ); // // defparam wfifo.lpm_hint = "RAM_BLOCK_TYPE=AUTO", // wfifo.lpm_numwords = 64, // wfifo.lpm_showahead = "OFF", // wfifo.lpm_type = "scfifo", // wfifo.lpm_width = 8, // wfifo.lpm_widthu = 6, // wfifo.overflow_checking = "OFF", // wfifo.underflow_checking = "OFF", // wfifo.use_eab = "ON"; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG_sim_scfifo_r ( // inputs: clk, fifo_rd, rst_n, // outputs: fifo_EF, fifo_rdata, rfifo_full, rfifo_used ) ; output fifo_EF; output [ 7: 0] fifo_rdata; output rfifo_full; output [ 5: 0] rfifo_used; input clk; input fifo_rd; input rst_n; reg [ 31: 0] bytes_left; wire fifo_EF; reg fifo_rd_d; wire [ 7: 0] fifo_rdata; wire new_rom; wire [ 31: 0] num_bytes; wire [ 6: 0] rfifo_entries; wire rfifo_full; wire [ 5: 0] rfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS // Generate rfifo_entries for simulation always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin bytes_left <= 32'h0; fifo_rd_d <= 1'b0; end else begin fifo_rd_d <= fifo_rd; // decrement on read if (fifo_rd_d) bytes_left <= bytes_left - 1'b1; // catch new contents if (new_rom) bytes_left <= num_bytes; end end assign fifo_EF = bytes_left == 32'b0; assign rfifo_full = bytes_left > 7'h40; assign rfifo_entries = (rfifo_full) ? 7'h40 : bytes_left; assign rfifo_used = rfifo_entries[5 : 0]; assign new_rom = 1'b0; assign num_bytes = 32'b0; assign fifo_rdata = 8'b0; //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on endmodule
module soc_design_JTAG_scfifo_r ( // inputs: clk, fifo_clear, fifo_rd, rst_n, t_dat, wr_rfifo, // outputs: fifo_EF, fifo_rdata, rfifo_full, rfifo_used ) ; output fifo_EF; output [ 7: 0] fifo_rdata; output rfifo_full; output [ 5: 0] rfifo_used; input clk; input fifo_clear; input fifo_rd; input rst_n; input [ 7: 0] t_dat; input wr_rfifo; wire fifo_EF; wire [ 7: 0] fifo_rdata; wire rfifo_full; wire [ 5: 0] rfifo_used; //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS soc_design_JTAG_sim_scfifo_r the_soc_design_JTAG_sim_scfifo_r ( .clk (clk), .fifo_EF (fifo_EF), .fifo_rd (fifo_rd), .fifo_rdata (fifo_rdata), .rfifo_full (rfifo_full), .rfifo_used (rfifo_used), .rst_n (rst_n) ); //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // scfifo rfifo // ( // .aclr (fifo_clear), // .clock (clk), // .data (t_dat), // .empty (fifo_EF), // .full (rfifo_full), // .q (fifo_rdata), // .rdreq (fifo_rd), // .usedw (rfifo_used), // .wrreq (wr_rfifo) // ); // // defparam rfifo.lpm_hint = "RAM_BLOCK_TYPE=AUTO", // rfifo.lpm_numwords = 64, // rfifo.lpm_showahead = "OFF", // rfifo.lpm_type = "scfifo", // rfifo.lpm_width = 8, // rfifo.lpm_widthu = 6, // rfifo.overflow_checking = "OFF", // rfifo.underflow_checking = "OFF", // rfifo.use_eab = "ON"; // //synthesis read_comments_as_HDL off endmodule
module soc_design_JTAG ( // inputs: av_address, av_chipselect, av_read_n, av_write_n, av_writedata, clk, rst_n, // outputs: av_irq, av_readdata, av_waitrequest, dataavailable, readyfordata ) /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"R101,C106,D101,D103\"" */ ; output av_irq; output [ 31: 0] av_readdata; output av_waitrequest; output dataavailable; output readyfordata; input av_address; input av_chipselect; input av_read_n; input av_write_n; input [ 31: 0] av_writedata; input clk; input rst_n; reg ac; wire activity; wire av_irq; wire [ 31: 0] av_readdata; reg av_waitrequest; reg dataavailable; reg fifo_AE; reg fifo_AF; wire fifo_EF; wire fifo_FF; wire fifo_clear; wire fifo_rd; wire [ 7: 0] fifo_rdata; wire [ 7: 0] fifo_wdata; reg fifo_wr; reg ien_AE; reg ien_AF; wire ipen_AE; wire ipen_AF; reg pause_irq; wire [ 7: 0] r_dat; wire r_ena; reg r_val; wire rd_wfifo; reg read_0; reg readyfordata; wire rfifo_full; wire [ 5: 0] rfifo_used; reg rvalid; reg sim_r_ena; reg sim_t_dat; reg sim_t_ena; reg sim_t_pause; wire [ 7: 0] t_dat; reg t_dav; wire t_ena; wire t_pause; wire wfifo_empty; wire [ 5: 0] wfifo_used; reg woverflow; wire wr_rfifo; //avalon_jtag_slave, which is an e_avalon_slave assign rd_wfifo = r_ena & ~wfifo_empty; assign wr_rfifo = t_ena & ~rfifo_full; assign fifo_clear = ~rst_n; soc_design_JTAG_scfifo_w the_soc_design_JTAG_scfifo_w ( .clk (clk), .fifo_FF (fifo_FF), .fifo_clear (fifo_clear), .fifo_wdata (fifo_wdata), .fifo_wr (fifo_wr), .r_dat (r_dat), .rd_wfifo (rd_wfifo), .wfifo_empty (wfifo_empty), .wfifo_used (wfifo_used) ); soc_design_JTAG_scfifo_r the_soc_design_JTAG_scfifo_r ( .clk (clk), .fifo_EF (fifo_EF), .fifo_clear (fifo_clear), .fifo_rd (fifo_rd), .fifo_rdata (fifo_rdata), .rfifo_full (rfifo_full), .rfifo_used (rfifo_used), .rst_n (rst_n), .t_dat (t_dat), .wr_rfifo (wr_rfifo) ); assign ipen_AE = ien_AE & fifo_AE; assign ipen_AF = ien_AF & (pause_irq | fifo_AF); assign av_irq = ipen_AE | ipen_AF; assign activity = t_pause | t_ena; always @(posedge clk or negedge rst_n) begin if (rst_n == 0) pause_irq <= 1'b0; else // only if fifo is not empty... if (t_pause & ~fifo_EF) pause_irq <= 1'b1; else if (read_0) pause_irq <= 1'b0; end always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin r_val <= 1'b0; t_dav <= 1'b1; end else begin r_val <= r_ena & ~wfifo_empty; t_dav <= ~rfifo_full; end end always @(posedge clk or negedge rst_n) begin if (rst_n == 0) begin fifo_AE <= 1'b0; fifo_AF <= 1'b0; fifo_wr <= 1'b0; rvalid <= 1'b0; read_0 <= 1'b0; ien_AE <= 1'b0; ien_AF <= 1'b0; ac <= 1'b0; woverflow <= 1'b0; av_waitrequest <= 1'b1; end else begin fifo_AE <= {fifo_FF,wfifo_used} <= 8; fifo_AF <= (7'h40 - {rfifo_full,rfifo_used}) <= 8; fifo_wr <= 1'b0; read_0 <= 1'b0; av_waitrequest <= ~(av_chipselect & (~av_write_n | ~av_read_n) & av_waitrequest); if (activity) ac <= 1'b1; // write if (av_chipselect & ~av_write_n & av_waitrequest) // addr 1 is control; addr 0 is data if (av_address) begin ien_AF <= av_writedata[0]; ien_AE <= av_writedata[1]; if (av_writedata[10] & ~activity) ac <= 1'b0; end else begin fifo_wr <= ~fifo_FF; woverflow <= fifo_FF; end // read if (av_chipselect & ~av_read_n & av_waitrequest) begin // addr 1 is interrupt; addr 0 is data if (~av_address) rvalid <= ~fifo_EF; read_0 <= ~av_address; end end end assign fifo_wdata = av_writedata[7 : 0]; assign fifo_rd = (av_chipselect & ~av_read_n & av_waitrequest & ~av_address) ? ~fifo_EF : 1'b0; assign av_readdata = read_0 ? { {9{1'b0}},rfifo_full,rfifo_used,rvalid,woverflow,~fifo_FF,~fifo_EF,1'b0,ac,ipen_AE,ipen_AF,fifo_rdata } : { {9{1'b0}},(7'h40 - {fifo_FF,wfifo_used}),rvalid,woverflow,~fifo_FF,~fifo_EF,1'b0,ac,ipen_AE,ipen_AF,{6{1'b0}},ien_AE,ien_AF }; always @(posedge clk or negedge rst_n) begin if (rst_n == 0) readyfordata <= 0; else readyfordata <= ~fifo_FF; end //synthesis translate_off //////////////// SIMULATION-ONLY CONTENTS // Tie off Atlantic Interface signals not used for simulation always @(posedge clk) begin sim_t_pause <= 1'b0; sim_t_ena <= 1'b0; sim_t_dat <= t_dav ? r_dat : {8{r_val}}; sim_r_ena <= 1'b0; end assign r_ena = sim_r_ena; assign t_ena = sim_t_ena; assign t_dat = sim_t_dat; assign t_pause = sim_t_pause; always @(fifo_EF) begin dataavailable = ~fifo_EF; end //////////////// END SIMULATION-ONLY CONTENTS //synthesis translate_on //synthesis read_comments_as_HDL on // alt_jtag_atlantic soc_design_JTAG_alt_jtag_atlantic // ( // .clk (clk), // .r_dat (r_dat), // .r_ena (r_ena), // .r_val (r_val), // .rst_n (rst_n), // .t_dat (t_dat), // .t_dav (t_dav), // .t_ena (t_ena), // .t_pause (t_pause) // ); // // defparam soc_design_JTAG_alt_jtag_atlantic.INSTANCE_ID = 0, // soc_design_JTAG_alt_jtag_atlantic.LOG2_RXFIFO_DEPTH = 6, // soc_design_JTAG_alt_jtag_atlantic.LOG2_TXFIFO_DEPTH = 6, // soc_design_JTAG_alt_jtag_atlantic.SLD_AUTO_INSTANCE_INDEX = "YES"; // // always @(posedge clk or negedge rst_n) // begin // if (rst_n == 0) // dataavailable <= 0; // else // dataavailable <= ~fifo_EF; // end // // //synthesis read_comments_as_HDL off endmodule
module axi_protocol_converter_v2_1_b_downsizer # ( parameter C_FAMILY = "none", // FPGA Family. Current version: virtex6 or spartan6. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of converter. // Range: >= 1. parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, // 1 = Propagate all USER signals, 0 = Don�t propagate. parameter integer C_AXI_BUSER_WIDTH = 1 // Width of BUSER signals. // Range: >= 1. ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface input wire cmd_valid, input wire cmd_split, input wire [4-1:0] cmd_repeat, output wire cmd_ready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY ); ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for packing levels. localparam [2-1:0] C_RESP_OKAY = 2'b00; localparam [2-1:0] C_RESP_EXOKAY = 2'b01; localparam [2-1:0] C_RESP_SLVERROR = 2'b10; localparam [2-1:0] C_RESP_DECERR = 2'b11; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Throttling help signals. wire cmd_ready_i; wire pop_mi_data; wire mi_stalling; // Repeat handling related. reg [4-1:0] repeat_cnt_pre; reg [4-1:0] repeat_cnt; wire [4-1:0] next_repeat_cnt; reg first_mi_word; wire last_word; // Ongoing split transaction. wire load_bresp; wire need_to_update_bresp; reg [2-1:0] S_AXI_BRESP_ACC; // Internal signals for MI-side. wire M_AXI_BREADY_I; // Internal signals for SI-side. wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID_I; reg [2-1:0] S_AXI_BRESP_I; wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER_I; wire S_AXI_BVALID_I; wire S_AXI_BREADY_I; ///////////////////////////////////////////////////////////////////////////// // Handle interface handshaking: // // The MI-side BRESP is popped when at once for split transactions, except // for the last cycle that behaves like a "normal" transaction. // A "normal" BRESP is popped once the SI-side is able to use it, // // ///////////////////////////////////////////////////////////////////////////// // Pop word from MI-side. assign M_AXI_BREADY_I = M_AXI_BVALID & ~mi_stalling; assign M_AXI_BREADY = M_AXI_BREADY_I; // Indicate when there is a BRESP available @ SI-side. assign S_AXI_BVALID_I = M_AXI_BVALID & last_word; // Get MI-side data. assign pop_mi_data = M_AXI_BVALID & M_AXI_BREADY_I; // Signal that the command is done (so that it can be poped from command queue). assign cmd_ready_i = cmd_valid & pop_mi_data & last_word; assign cmd_ready = cmd_ready_i; // Detect when MI-side is stalling. assign mi_stalling = (~S_AXI_BREADY_I & last_word); ///////////////////////////////////////////////////////////////////////////// // Handle the accumulation of BRESP. // // Forward the accumulated or MI-side BRESP value depending on state: // * MI-side BRESP is forwarded untouched when it is a non split cycle. // (MI-side BRESP value is also used when updating the accumulated for // the last access during a split access). // * The accumulated BRESP is for a split transaction. // // The accumulated BRESP register is updated for each MI-side response that // is used. // ///////////////////////////////////////////////////////////////////////////// // Force load accumulated BRESPs to first value assign load_bresp = (cmd_split & first_mi_word); // Update if more critical. assign need_to_update_bresp = ( M_AXI_BRESP > S_AXI_BRESP_ACC ); // Select accumultated or direct depending on setting. always @ * begin if ( cmd_split ) begin if ( load_bresp || need_to_update_bresp ) begin S_AXI_BRESP_I = M_AXI_BRESP; end else begin S_AXI_BRESP_I = S_AXI_BRESP_ACC; end end else begin S_AXI_BRESP_I = M_AXI_BRESP; end end // Accumulate MI-side BRESP. always @ (posedge ACLK) begin if (ARESET) begin S_AXI_BRESP_ACC <= C_RESP_OKAY; end else begin if ( pop_mi_data ) begin S_AXI_BRESP_ACC <= S_AXI_BRESP_I; end end end ///////////////////////////////////////////////////////////////////////////// // Keep track of BRESP repeat counter. // // Last BRESP word is either: // * The first and only word when not merging. // * The last value when merging. // // The internal counter is taken from the external command interface during // the first response when merging. The counter is updated each time a // BRESP is popped from the MI-side interface. // ///////////////////////////////////////////////////////////////////////////// // Determine last BRESP cycle. assign last_word = ( ( repeat_cnt == 4'b0 ) & ~first_mi_word ) | ~cmd_split; // Select command reapeat or counted repeat value. always @ * begin if ( first_mi_word ) begin repeat_cnt_pre = cmd_repeat; end else begin repeat_cnt_pre = repeat_cnt; end end // Calculate next repeat counter value. assign next_repeat_cnt = repeat_cnt_pre - 1'b1; // Keep track of the repeat count. always @ (posedge ACLK) begin if (ARESET) begin repeat_cnt <= 4'b0; first_mi_word <= 1'b1; end else begin if ( pop_mi_data ) begin repeat_cnt <= next_repeat_cnt; first_mi_word <= last_word; end end end ///////////////////////////////////////////////////////////////////////////// // BID Handling ///////////////////////////////////////////////////////////////////////////// assign S_AXI_BID_I = M_AXI_BID; ///////////////////////////////////////////////////////////////////////////// // USER Data bits // // The last USER bits are simply taken from the last BRESP that is merged. // Ground USER bits when unused. ///////////////////////////////////////////////////////////////////////////// // Select USER bits. assign S_AXI_BUSER_I = {C_AXI_BUSER_WIDTH{1'b0}}; ///////////////////////////////////////////////////////////////////////////// // SI-side output handling ///////////////////////////////////////////////////////////////////////////// // TODO: registered? assign S_AXI_BID = S_AXI_BID_I; assign S_AXI_BRESP = S_AXI_BRESP_I; assign S_AXI_BUSER = S_AXI_BUSER_I; assign S_AXI_BVALID = S_AXI_BVALID_I; assign S_AXI_BREADY_I = S_AXI_BREADY; endmodule
module axi_protocol_converter_v2_1_b_downsizer # ( parameter C_FAMILY = "none", // FPGA Family. Current version: virtex6 or spartan6. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of converter. // Range: >= 1. parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, // 1 = Propagate all USER signals, 0 = Don�t propagate. parameter integer C_AXI_BUSER_WIDTH = 1 // Width of BUSER signals. // Range: >= 1. ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface input wire cmd_valid, input wire cmd_split, input wire [4-1:0] cmd_repeat, output wire cmd_ready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY ); ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for packing levels. localparam [2-1:0] C_RESP_OKAY = 2'b00; localparam [2-1:0] C_RESP_EXOKAY = 2'b01; localparam [2-1:0] C_RESP_SLVERROR = 2'b10; localparam [2-1:0] C_RESP_DECERR = 2'b11; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Throttling help signals. wire cmd_ready_i; wire pop_mi_data; wire mi_stalling; // Repeat handling related. reg [4-1:0] repeat_cnt_pre; reg [4-1:0] repeat_cnt; wire [4-1:0] next_repeat_cnt; reg first_mi_word; wire last_word; // Ongoing split transaction. wire load_bresp; wire need_to_update_bresp; reg [2-1:0] S_AXI_BRESP_ACC; // Internal signals for MI-side. wire M_AXI_BREADY_I; // Internal signals for SI-side. wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID_I; reg [2-1:0] S_AXI_BRESP_I; wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER_I; wire S_AXI_BVALID_I; wire S_AXI_BREADY_I; ///////////////////////////////////////////////////////////////////////////// // Handle interface handshaking: // // The MI-side BRESP is popped when at once for split transactions, except // for the last cycle that behaves like a "normal" transaction. // A "normal" BRESP is popped once the SI-side is able to use it, // // ///////////////////////////////////////////////////////////////////////////// // Pop word from MI-side. assign M_AXI_BREADY_I = M_AXI_BVALID & ~mi_stalling; assign M_AXI_BREADY = M_AXI_BREADY_I; // Indicate when there is a BRESP available @ SI-side. assign S_AXI_BVALID_I = M_AXI_BVALID & last_word; // Get MI-side data. assign pop_mi_data = M_AXI_BVALID & M_AXI_BREADY_I; // Signal that the command is done (so that it can be poped from command queue). assign cmd_ready_i = cmd_valid & pop_mi_data & last_word; assign cmd_ready = cmd_ready_i; // Detect when MI-side is stalling. assign mi_stalling = (~S_AXI_BREADY_I & last_word); ///////////////////////////////////////////////////////////////////////////// // Handle the accumulation of BRESP. // // Forward the accumulated or MI-side BRESP value depending on state: // * MI-side BRESP is forwarded untouched when it is a non split cycle. // (MI-side BRESP value is also used when updating the accumulated for // the last access during a split access). // * The accumulated BRESP is for a split transaction. // // The accumulated BRESP register is updated for each MI-side response that // is used. // ///////////////////////////////////////////////////////////////////////////// // Force load accumulated BRESPs to first value assign load_bresp = (cmd_split & first_mi_word); // Update if more critical. assign need_to_update_bresp = ( M_AXI_BRESP > S_AXI_BRESP_ACC ); // Select accumultated or direct depending on setting. always @ * begin if ( cmd_split ) begin if ( load_bresp || need_to_update_bresp ) begin S_AXI_BRESP_I = M_AXI_BRESP; end else begin S_AXI_BRESP_I = S_AXI_BRESP_ACC; end end else begin S_AXI_BRESP_I = M_AXI_BRESP; end end // Accumulate MI-side BRESP. always @ (posedge ACLK) begin if (ARESET) begin S_AXI_BRESP_ACC <= C_RESP_OKAY; end else begin if ( pop_mi_data ) begin S_AXI_BRESP_ACC <= S_AXI_BRESP_I; end end end ///////////////////////////////////////////////////////////////////////////// // Keep track of BRESP repeat counter. // // Last BRESP word is either: // * The first and only word when not merging. // * The last value when merging. // // The internal counter is taken from the external command interface during // the first response when merging. The counter is updated each time a // BRESP is popped from the MI-side interface. // ///////////////////////////////////////////////////////////////////////////// // Determine last BRESP cycle. assign last_word = ( ( repeat_cnt == 4'b0 ) & ~first_mi_word ) | ~cmd_split; // Select command reapeat or counted repeat value. always @ * begin if ( first_mi_word ) begin repeat_cnt_pre = cmd_repeat; end else begin repeat_cnt_pre = repeat_cnt; end end // Calculate next repeat counter value. assign next_repeat_cnt = repeat_cnt_pre - 1'b1; // Keep track of the repeat count. always @ (posedge ACLK) begin if (ARESET) begin repeat_cnt <= 4'b0; first_mi_word <= 1'b1; end else begin if ( pop_mi_data ) begin repeat_cnt <= next_repeat_cnt; first_mi_word <= last_word; end end end ///////////////////////////////////////////////////////////////////////////// // BID Handling ///////////////////////////////////////////////////////////////////////////// assign S_AXI_BID_I = M_AXI_BID; ///////////////////////////////////////////////////////////////////////////// // USER Data bits // // The last USER bits are simply taken from the last BRESP that is merged. // Ground USER bits when unused. ///////////////////////////////////////////////////////////////////////////// // Select USER bits. assign S_AXI_BUSER_I = {C_AXI_BUSER_WIDTH{1'b0}}; ///////////////////////////////////////////////////////////////////////////// // SI-side output handling ///////////////////////////////////////////////////////////////////////////// // TODO: registered? assign S_AXI_BID = S_AXI_BID_I; assign S_AXI_BRESP = S_AXI_BRESP_I; assign S_AXI_BUSER = S_AXI_BUSER_I; assign S_AXI_BVALID = S_AXI_BVALID_I; assign S_AXI_BREADY_I = S_AXI_BREADY; endmodule
module axi_protocol_converter_v2_1_b_downsizer # ( parameter C_FAMILY = "none", // FPGA Family. Current version: virtex6 or spartan6. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of converter. // Range: >= 1. parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, // 1 = Propagate all USER signals, 0 = Don�t propagate. parameter integer C_AXI_BUSER_WIDTH = 1 // Width of BUSER signals. // Range: >= 1. ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface input wire cmd_valid, input wire cmd_split, input wire [4-1:0] cmd_repeat, output wire cmd_ready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY ); ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for packing levels. localparam [2-1:0] C_RESP_OKAY = 2'b00; localparam [2-1:0] C_RESP_EXOKAY = 2'b01; localparam [2-1:0] C_RESP_SLVERROR = 2'b10; localparam [2-1:0] C_RESP_DECERR = 2'b11; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Throttling help signals. wire cmd_ready_i; wire pop_mi_data; wire mi_stalling; // Repeat handling related. reg [4-1:0] repeat_cnt_pre; reg [4-1:0] repeat_cnt; wire [4-1:0] next_repeat_cnt; reg first_mi_word; wire last_word; // Ongoing split transaction. wire load_bresp; wire need_to_update_bresp; reg [2-1:0] S_AXI_BRESP_ACC; // Internal signals for MI-side. wire M_AXI_BREADY_I; // Internal signals for SI-side. wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID_I; reg [2-1:0] S_AXI_BRESP_I; wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER_I; wire S_AXI_BVALID_I; wire S_AXI_BREADY_I; ///////////////////////////////////////////////////////////////////////////// // Handle interface handshaking: // // The MI-side BRESP is popped when at once for split transactions, except // for the last cycle that behaves like a "normal" transaction. // A "normal" BRESP is popped once the SI-side is able to use it, // // ///////////////////////////////////////////////////////////////////////////// // Pop word from MI-side. assign M_AXI_BREADY_I = M_AXI_BVALID & ~mi_stalling; assign M_AXI_BREADY = M_AXI_BREADY_I; // Indicate when there is a BRESP available @ SI-side. assign S_AXI_BVALID_I = M_AXI_BVALID & last_word; // Get MI-side data. assign pop_mi_data = M_AXI_BVALID & M_AXI_BREADY_I; // Signal that the command is done (so that it can be poped from command queue). assign cmd_ready_i = cmd_valid & pop_mi_data & last_word; assign cmd_ready = cmd_ready_i; // Detect when MI-side is stalling. assign mi_stalling = (~S_AXI_BREADY_I & last_word); ///////////////////////////////////////////////////////////////////////////// // Handle the accumulation of BRESP. // // Forward the accumulated or MI-side BRESP value depending on state: // * MI-side BRESP is forwarded untouched when it is a non split cycle. // (MI-side BRESP value is also used when updating the accumulated for // the last access during a split access). // * The accumulated BRESP is for a split transaction. // // The accumulated BRESP register is updated for each MI-side response that // is used. // ///////////////////////////////////////////////////////////////////////////// // Force load accumulated BRESPs to first value assign load_bresp = (cmd_split & first_mi_word); // Update if more critical. assign need_to_update_bresp = ( M_AXI_BRESP > S_AXI_BRESP_ACC ); // Select accumultated or direct depending on setting. always @ * begin if ( cmd_split ) begin if ( load_bresp || need_to_update_bresp ) begin S_AXI_BRESP_I = M_AXI_BRESP; end else begin S_AXI_BRESP_I = S_AXI_BRESP_ACC; end end else begin S_AXI_BRESP_I = M_AXI_BRESP; end end // Accumulate MI-side BRESP. always @ (posedge ACLK) begin if (ARESET) begin S_AXI_BRESP_ACC <= C_RESP_OKAY; end else begin if ( pop_mi_data ) begin S_AXI_BRESP_ACC <= S_AXI_BRESP_I; end end end ///////////////////////////////////////////////////////////////////////////// // Keep track of BRESP repeat counter. // // Last BRESP word is either: // * The first and only word when not merging. // * The last value when merging. // // The internal counter is taken from the external command interface during // the first response when merging. The counter is updated each time a // BRESP is popped from the MI-side interface. // ///////////////////////////////////////////////////////////////////////////// // Determine last BRESP cycle. assign last_word = ( ( repeat_cnt == 4'b0 ) & ~first_mi_word ) | ~cmd_split; // Select command reapeat or counted repeat value. always @ * begin if ( first_mi_word ) begin repeat_cnt_pre = cmd_repeat; end else begin repeat_cnt_pre = repeat_cnt; end end // Calculate next repeat counter value. assign next_repeat_cnt = repeat_cnt_pre - 1'b1; // Keep track of the repeat count. always @ (posedge ACLK) begin if (ARESET) begin repeat_cnt <= 4'b0; first_mi_word <= 1'b1; end else begin if ( pop_mi_data ) begin repeat_cnt <= next_repeat_cnt; first_mi_word <= last_word; end end end ///////////////////////////////////////////////////////////////////////////// // BID Handling ///////////////////////////////////////////////////////////////////////////// assign S_AXI_BID_I = M_AXI_BID; ///////////////////////////////////////////////////////////////////////////// // USER Data bits // // The last USER bits are simply taken from the last BRESP that is merged. // Ground USER bits when unused. ///////////////////////////////////////////////////////////////////////////// // Select USER bits. assign S_AXI_BUSER_I = {C_AXI_BUSER_WIDTH{1'b0}}; ///////////////////////////////////////////////////////////////////////////// // SI-side output handling ///////////////////////////////////////////////////////////////////////////// // TODO: registered? assign S_AXI_BID = S_AXI_BID_I; assign S_AXI_BRESP = S_AXI_BRESP_I; assign S_AXI_BUSER = S_AXI_BUSER_I; assign S_AXI_BVALID = S_AXI_BVALID_I; assign S_AXI_BREADY_I = S_AXI_BREADY; endmodule
module axi_protocol_converter_v2_1_b_downsizer # ( parameter C_FAMILY = "none", // FPGA Family. Current version: virtex6 or spartan6. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of converter. // Range: >= 1. parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, // 1 = Propagate all USER signals, 0 = Don�t propagate. parameter integer C_AXI_BUSER_WIDTH = 1 // Width of BUSER signals. // Range: >= 1. ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface input wire cmd_valid, input wire cmd_split, input wire [4-1:0] cmd_repeat, output wire cmd_ready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY ); ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for packing levels. localparam [2-1:0] C_RESP_OKAY = 2'b00; localparam [2-1:0] C_RESP_EXOKAY = 2'b01; localparam [2-1:0] C_RESP_SLVERROR = 2'b10; localparam [2-1:0] C_RESP_DECERR = 2'b11; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Throttling help signals. wire cmd_ready_i; wire pop_mi_data; wire mi_stalling; // Repeat handling related. reg [4-1:0] repeat_cnt_pre; reg [4-1:0] repeat_cnt; wire [4-1:0] next_repeat_cnt; reg first_mi_word; wire last_word; // Ongoing split transaction. wire load_bresp; wire need_to_update_bresp; reg [2-1:0] S_AXI_BRESP_ACC; // Internal signals for MI-side. wire M_AXI_BREADY_I; // Internal signals for SI-side. wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID_I; reg [2-1:0] S_AXI_BRESP_I; wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER_I; wire S_AXI_BVALID_I; wire S_AXI_BREADY_I; ///////////////////////////////////////////////////////////////////////////// // Handle interface handshaking: // // The MI-side BRESP is popped when at once for split transactions, except // for the last cycle that behaves like a "normal" transaction. // A "normal" BRESP is popped once the SI-side is able to use it, // // ///////////////////////////////////////////////////////////////////////////// // Pop word from MI-side. assign M_AXI_BREADY_I = M_AXI_BVALID & ~mi_stalling; assign M_AXI_BREADY = M_AXI_BREADY_I; // Indicate when there is a BRESP available @ SI-side. assign S_AXI_BVALID_I = M_AXI_BVALID & last_word; // Get MI-side data. assign pop_mi_data = M_AXI_BVALID & M_AXI_BREADY_I; // Signal that the command is done (so that it can be poped from command queue). assign cmd_ready_i = cmd_valid & pop_mi_data & last_word; assign cmd_ready = cmd_ready_i; // Detect when MI-side is stalling. assign mi_stalling = (~S_AXI_BREADY_I & last_word); ///////////////////////////////////////////////////////////////////////////// // Handle the accumulation of BRESP. // // Forward the accumulated or MI-side BRESP value depending on state: // * MI-side BRESP is forwarded untouched when it is a non split cycle. // (MI-side BRESP value is also used when updating the accumulated for // the last access during a split access). // * The accumulated BRESP is for a split transaction. // // The accumulated BRESP register is updated for each MI-side response that // is used. // ///////////////////////////////////////////////////////////////////////////// // Force load accumulated BRESPs to first value assign load_bresp = (cmd_split & first_mi_word); // Update if more critical. assign need_to_update_bresp = ( M_AXI_BRESP > S_AXI_BRESP_ACC ); // Select accumultated or direct depending on setting. always @ * begin if ( cmd_split ) begin if ( load_bresp || need_to_update_bresp ) begin S_AXI_BRESP_I = M_AXI_BRESP; end else begin S_AXI_BRESP_I = S_AXI_BRESP_ACC; end end else begin S_AXI_BRESP_I = M_AXI_BRESP; end end // Accumulate MI-side BRESP. always @ (posedge ACLK) begin if (ARESET) begin S_AXI_BRESP_ACC <= C_RESP_OKAY; end else begin if ( pop_mi_data ) begin S_AXI_BRESP_ACC <= S_AXI_BRESP_I; end end end ///////////////////////////////////////////////////////////////////////////// // Keep track of BRESP repeat counter. // // Last BRESP word is either: // * The first and only word when not merging. // * The last value when merging. // // The internal counter is taken from the external command interface during // the first response when merging. The counter is updated each time a // BRESP is popped from the MI-side interface. // ///////////////////////////////////////////////////////////////////////////// // Determine last BRESP cycle. assign last_word = ( ( repeat_cnt == 4'b0 ) & ~first_mi_word ) | ~cmd_split; // Select command reapeat or counted repeat value. always @ * begin if ( first_mi_word ) begin repeat_cnt_pre = cmd_repeat; end else begin repeat_cnt_pre = repeat_cnt; end end // Calculate next repeat counter value. assign next_repeat_cnt = repeat_cnt_pre - 1'b1; // Keep track of the repeat count. always @ (posedge ACLK) begin if (ARESET) begin repeat_cnt <= 4'b0; first_mi_word <= 1'b1; end else begin if ( pop_mi_data ) begin repeat_cnt <= next_repeat_cnt; first_mi_word <= last_word; end end end ///////////////////////////////////////////////////////////////////////////// // BID Handling ///////////////////////////////////////////////////////////////////////////// assign S_AXI_BID_I = M_AXI_BID; ///////////////////////////////////////////////////////////////////////////// // USER Data bits // // The last USER bits are simply taken from the last BRESP that is merged. // Ground USER bits when unused. ///////////////////////////////////////////////////////////////////////////// // Select USER bits. assign S_AXI_BUSER_I = {C_AXI_BUSER_WIDTH{1'b0}}; ///////////////////////////////////////////////////////////////////////////// // SI-side output handling ///////////////////////////////////////////////////////////////////////////// // TODO: registered? assign S_AXI_BID = S_AXI_BID_I; assign S_AXI_BRESP = S_AXI_BRESP_I; assign S_AXI_BUSER = S_AXI_BUSER_I; assign S_AXI_BVALID = S_AXI_BVALID_I; assign S_AXI_BREADY_I = S_AXI_BREADY; endmodule
module axi_protocol_converter_v2_1_b_downsizer # ( parameter C_FAMILY = "none", // FPGA Family. Current version: virtex6 or spartan6. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of converter. // Range: >= 1. parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, // 1 = Propagate all USER signals, 0 = Don�t propagate. parameter integer C_AXI_BUSER_WIDTH = 1 // Width of BUSER signals. // Range: >= 1. ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface input wire cmd_valid, input wire cmd_split, input wire [4-1:0] cmd_repeat, output wire cmd_ready, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY ); ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for packing levels. localparam [2-1:0] C_RESP_OKAY = 2'b00; localparam [2-1:0] C_RESP_EXOKAY = 2'b01; localparam [2-1:0] C_RESP_SLVERROR = 2'b10; localparam [2-1:0] C_RESP_DECERR = 2'b11; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Throttling help signals. wire cmd_ready_i; wire pop_mi_data; wire mi_stalling; // Repeat handling related. reg [4-1:0] repeat_cnt_pre; reg [4-1:0] repeat_cnt; wire [4-1:0] next_repeat_cnt; reg first_mi_word; wire last_word; // Ongoing split transaction. wire load_bresp; wire need_to_update_bresp; reg [2-1:0] S_AXI_BRESP_ACC; // Internal signals for MI-side. wire M_AXI_BREADY_I; // Internal signals for SI-side. wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID_I; reg [2-1:0] S_AXI_BRESP_I; wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER_I; wire S_AXI_BVALID_I; wire S_AXI_BREADY_I; ///////////////////////////////////////////////////////////////////////////// // Handle interface handshaking: // // The MI-side BRESP is popped when at once for split transactions, except // for the last cycle that behaves like a "normal" transaction. // A "normal" BRESP is popped once the SI-side is able to use it, // // ///////////////////////////////////////////////////////////////////////////// // Pop word from MI-side. assign M_AXI_BREADY_I = M_AXI_BVALID & ~mi_stalling; assign M_AXI_BREADY = M_AXI_BREADY_I; // Indicate when there is a BRESP available @ SI-side. assign S_AXI_BVALID_I = M_AXI_BVALID & last_word; // Get MI-side data. assign pop_mi_data = M_AXI_BVALID & M_AXI_BREADY_I; // Signal that the command is done (so that it can be poped from command queue). assign cmd_ready_i = cmd_valid & pop_mi_data & last_word; assign cmd_ready = cmd_ready_i; // Detect when MI-side is stalling. assign mi_stalling = (~S_AXI_BREADY_I & last_word); ///////////////////////////////////////////////////////////////////////////// // Handle the accumulation of BRESP. // // Forward the accumulated or MI-side BRESP value depending on state: // * MI-side BRESP is forwarded untouched when it is a non split cycle. // (MI-side BRESP value is also used when updating the accumulated for // the last access during a split access). // * The accumulated BRESP is for a split transaction. // // The accumulated BRESP register is updated for each MI-side response that // is used. // ///////////////////////////////////////////////////////////////////////////// // Force load accumulated BRESPs to first value assign load_bresp = (cmd_split & first_mi_word); // Update if more critical. assign need_to_update_bresp = ( M_AXI_BRESP > S_AXI_BRESP_ACC ); // Select accumultated or direct depending on setting. always @ * begin if ( cmd_split ) begin if ( load_bresp || need_to_update_bresp ) begin S_AXI_BRESP_I = M_AXI_BRESP; end else begin S_AXI_BRESP_I = S_AXI_BRESP_ACC; end end else begin S_AXI_BRESP_I = M_AXI_BRESP; end end // Accumulate MI-side BRESP. always @ (posedge ACLK) begin if (ARESET) begin S_AXI_BRESP_ACC <= C_RESP_OKAY; end else begin if ( pop_mi_data ) begin S_AXI_BRESP_ACC <= S_AXI_BRESP_I; end end end ///////////////////////////////////////////////////////////////////////////// // Keep track of BRESP repeat counter. // // Last BRESP word is either: // * The first and only word when not merging. // * The last value when merging. // // The internal counter is taken from the external command interface during // the first response when merging. The counter is updated each time a // BRESP is popped from the MI-side interface. // ///////////////////////////////////////////////////////////////////////////// // Determine last BRESP cycle. assign last_word = ( ( repeat_cnt == 4'b0 ) & ~first_mi_word ) | ~cmd_split; // Select command reapeat or counted repeat value. always @ * begin if ( first_mi_word ) begin repeat_cnt_pre = cmd_repeat; end else begin repeat_cnt_pre = repeat_cnt; end end // Calculate next repeat counter value. assign next_repeat_cnt = repeat_cnt_pre - 1'b1; // Keep track of the repeat count. always @ (posedge ACLK) begin if (ARESET) begin repeat_cnt <= 4'b0; first_mi_word <= 1'b1; end else begin if ( pop_mi_data ) begin repeat_cnt <= next_repeat_cnt; first_mi_word <= last_word; end end end ///////////////////////////////////////////////////////////////////////////// // BID Handling ///////////////////////////////////////////////////////////////////////////// assign S_AXI_BID_I = M_AXI_BID; ///////////////////////////////////////////////////////////////////////////// // USER Data bits // // The last USER bits are simply taken from the last BRESP that is merged. // Ground USER bits when unused. ///////////////////////////////////////////////////////////////////////////// // Select USER bits. assign S_AXI_BUSER_I = {C_AXI_BUSER_WIDTH{1'b0}}; ///////////////////////////////////////////////////////////////////////////// // SI-side output handling ///////////////////////////////////////////////////////////////////////////// // TODO: registered? assign S_AXI_BID = S_AXI_BID_I; assign S_AXI_BRESP = S_AXI_BRESP_I; assign S_AXI_BUSER = S_AXI_BUSER_I; assign S_AXI_BVALID = S_AXI_BVALID_I; assign S_AXI_BREADY_I = S_AXI_BREADY; endmodule
module salsa (clk, B, Bx, Bo, X0out, Xaddr); // Latency 16 clock cycles, approx 20nS propagation delay (SLOW!) input clk; // input feedback; input [511:0]B; input [511:0]Bx; // output reg [511:0]Bo; // Output is registered output [511:0]Bo; // Output is async output [511:0]X0out; // Becomes new X0 output [9:0] Xaddr; wire [9:0] xa1, xa2, xa3, xa4, ya1, ya2, ya3, ya4; reg [511:0]x1d1, x1d1a; reg [511:0]x1d2, x1d2a; reg [511:0]x1d3, x1d3a; reg [511:0]x1d4, x1d4a; reg [511:0]Xod1, Xod1a; reg [511:0]Xod2, Xod2a; reg [511:0]Xod3, Xod3a; reg [511:0]Xod4, X0out; reg [511:0]xxd1, xxd1a; reg [511:0]xxd2, xxd2a; reg [511:0]xxd3, xxd3a; reg [511:0]xxd4, xxd4a; reg [511:0]yyd1, yyd1a; reg [511:0]yyd2, yyd2a; reg [511:0]yyd3, yyd3a; reg [511:0]yyd4, yyd4a; wire [511:0]xx; // Initial xor wire [511:0]x1; // Salasa core outputs wire [511:0]x2; wire [511:0]x3; wire [511:0]xr; wire [511:0]Xo; // Four salsa iterations. NB use registered salsa_core so 4 clock cycles. salsa_core salsax1 (clk, xx, x1, xa1); salsa_core salsax2 (clk, x1, x2, xa2); salsa_core salsax3 (clk, x2, x3, xa3); salsa_core salsax4 (clk, x3, xr, xa4); wire [511:0]yy; // Initial xor wire [511:0]y1; // Salasa core outputs wire [511:0]y2; wire [511:0]y3; wire [511:0]yr; // Four salsa iterations. NB use registered salsa_core so 4 clock cycles. salsa_core salsay1 (clk, yy, y1, ya1); salsa_core salsay2 (clk, y1, y2, ya2); salsa_core salsay3 (clk, y2, y3, ya3); salsa_core salsay4 (clk, y3, yr, ya4); assign Xaddr = yyd4[9:0] + ya4; genvar i; generate for (i = 0; i < 16; i = i + 1) begin : XX // Initial XOR. NB this adds to the propagation delay of the first salsa, may want register it. assign xx[`IDX(i)] = B[`IDX(i)] ^ Bx[`IDX(i)]; assign Xo[`IDX(i)] = xxd4a[`IDX(i)] + xr[`IDX(i)]; assign yy[`IDX(i)] = x1d4a[`IDX(i)] ^ Xo[`IDX(i)]; assign Bo[`IDX(i)] = yyd4a[`IDX(i)] + yr[`IDX(i)]; // Async output end endgenerate always @ (posedge clk) begin x1d1 <= Bx; x1d1a <= x1d1; x1d2 <= x1d1a; x1d2a <= x1d2; x1d3 <= x1d2a; x1d3a <= x1d3; x1d4 <= x1d3a; x1d4a <= x1d4; Xod1 <= Xo; Xod1a <= Xod1; Xod2 <= Xod1a; Xod2a <= Xod2; Xod3 <= Xod2a; Xod3a <= Xod3; Xod4 <= Xod3a; X0out <= Xod4; // We output this to become new X0 xxd1 <= xx; xxd1a <= xxd1; xxd2 <= xxd1a; xxd2a <= xxd2; xxd3 <= xxd2a; xxd3a <= xxd3; xxd4 <= xxd3a; xxd4a <= xxd4; yyd1 <= yy; yyd1a <= yyd1; yyd2 <= yyd1a; yyd2a <= yyd2; yyd3 <= yyd2a; yyd3a <= yyd3; yyd4 <= yyd3a; yyd4a <= yyd4; end endmodule
module salsa_core (clk, xx, out, Xaddr); input clk; input [511:0]xx; output reg [511:0]out; // Output is registered output [9:0] Xaddr; // Address output unregistered // This is clunky due to my lack of verilog skills but it works so elegance can come later wire [31:0]c00; // Column results wire [31:0]c01; wire [31:0]c02; wire [31:0]c03; wire [31:0]c04; wire [31:0]c05; wire [31:0]c06; wire [31:0]c07; wire [31:0]c08; wire [31:0]c09; wire [31:0]c10; wire [31:0]c11; wire [31:0]c12; wire [31:0]c13; wire [31:0]c14; wire [31:0]c15; wire [31:0]r00; // Row results wire [31:0]r01; wire [31:0]r02; wire [31:0]r03; wire [31:0]r04; wire [31:0]r05; wire [31:0]r06; wire [31:0]r07; wire [31:0]r08; wire [31:0]r09; wire [31:0]r10; wire [31:0]r11; wire [31:0]r12; wire [31:0]r13; wire [31:0]r14; wire [31:0]r15; wire [31:0]c00s; // Column sums wire [31:0]c01s; wire [31:0]c02s; wire [31:0]c03s; wire [31:0]c04s; wire [31:0]c05s; wire [31:0]c06s; wire [31:0]c07s; wire [31:0]c08s; wire [31:0]c09s; wire [31:0]c10s; wire [31:0]c11s; wire [31:0]c12s; wire [31:0]c13s; wire [31:0]c14s; wire [31:0]c15s; wire [31:0]r00s; // Row sums wire [31:0]r01s; wire [31:0]r02s; wire [31:0]r03s; wire [31:0]r04s; wire [31:0]r05s; wire [31:0]r06s; wire [31:0]r07s; wire [31:0]r08s; wire [31:0]r09s; wire [31:0]r10s; wire [31:0]r11s; wire [31:0]r12s; wire [31:0]r13s; wire [31:0]r14s; wire [31:0]r15s; reg [31:0]c00d; // Column results registered reg [31:0]c01d; reg [31:0]c02d; reg [31:0]c03d; reg [31:0]c04d; reg [31:0]c05d; reg [31:0]c06d; reg [31:0]c07d; reg [31:0]c08d; reg [31:0]c09d; reg [31:0]c10d; reg [31:0]c11d; reg [31:0]c12d; reg [31:0]c13d; reg [31:0]c14d; reg [31:0]c15d; /* From scrypt.c #define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) for (i = 0; i < 8; i += 2) { // Operate on columns x04 ^= R(x00+x12, 7); x09 ^= R(x05+x01, 7); x14 ^= R(x10+x06, 7); x03 ^= R(x15+x11, 7); x08 ^= R(x04+x00, 9); x13 ^= R(x09+x05, 9); x02 ^= R(x14+x10, 9); x07 ^= R(x03+x15, 9); x12 ^= R(x08+x04,13); x01 ^= R(x13+x09,13); x06 ^= R(x02+x14,13); x11 ^= R(x07+x03,13); x00 ^= R(x12+x08,18); x05 ^= R(x01+x13,18); x10 ^= R(x06+x02,18); x15 ^= R(x11+x07,18); // Operate on rows x01 ^= R(x00+x03, 7); x06 ^= R(x05+x04, 7); x11 ^= R(x10+x09, 7); x12 ^= R(x15+x14, 7); x02 ^= R(x01+x00, 9); x07 ^= R(x06+x05, 9); x08 ^= R(x11+x10, 9); x13 ^= R(x12+x15, 9); x03 ^= R(x02+x01,13); x04 ^= R(x07+x06,13); x09 ^= R(x08+x11,13); x14 ^= R(x13+x12,13); x00 ^= R(x03+x02,18); x05 ^= R(x04+x07,18); x10 ^= R(x09+x08,18); x15 ^= R(x14+x13,18); } */ // cols assign c04s = xx[`IDX(0)] + xx[`IDX(12)]; assign c04 = xx[`IDX(4)] ^ { c04s[24:0], c04s[31:25] }; assign c09s = xx[`IDX(5)] + xx[`IDX(1)]; assign c09 = xx[`IDX(9)] ^ { c09s[24:0], c09s[31:25] }; assign c14s = xx[`IDX(10)] + xx[`IDX(6)]; assign c14 = xx[`IDX(14)] ^ { c14s[24:0], c14s[31:25] }; assign c03s = xx[`IDX(15)] + xx[`IDX(11)]; assign c03 = xx[`IDX(03)] ^ { c03s[24:0], c03s[31:25] }; assign c08s = c04 + xx[`IDX(0)]; assign c08 = xx[`IDX(8)] ^ { c08s[22:0], c08s[31:23] }; assign c13s = c09 + xx[`IDX(5)]; assign c13 = xx[`IDX(13)] ^ { c13s[22:0], c13s[31:23] }; assign c02s = c14 + xx[`IDX(10)]; assign c02 = xx[`IDX(2)] ^ { c02s[22:0], c02s[31:23] }; assign c07s = c03 + xx[`IDX(15)]; assign c07 = xx[`IDX(7)] ^ { c07s[22:0], c07s[31:23] }; assign c12s = c08 + c04; assign c12 = xx[`IDX(12)] ^ { c12s[18:0], c12s[31:19] }; assign c01s = c13 + c09; assign c01 = xx[`IDX(1)] ^ { c01s[18:0], c01s[31:19] }; assign c06s = c02 + c14; assign c06 = xx[`IDX(6)] ^ { c06s[18:0], c06s[31:19] }; assign c11s = c07 + c03; assign c11 = xx[`IDX(11)] ^ { c11s[18:0], c11s[31:19] }; assign c00s = c12 + c08; assign c00 = xx[`IDX(0)] ^ { c00s[13:0], c00s[31:14] }; assign c05s = c01 + c13; assign c05 = xx[`IDX(5)] ^ { c05s[13:0], c05s[31:14] }; assign c10s = c06 + c02; assign c10 = xx[`IDX(10)] ^ { c10s[13:0], c10s[31:14] }; assign c15s = c11 + c07; assign c15 = xx[`IDX(15)] ^ { c15s[13:0], c15s[31:14] }; // rows assign r01s = c00d + c03d; assign r01 = c01d ^ { r01s[24:0], r01s[31:25] }; assign r06s = c05d + c04d; assign r06 = c06d ^ { r06s[24:0], r06s[31:25] }; assign r11s = c10d + c09d; assign r11 = c11d ^ { r11s[24:0], r11s[31:25] }; assign r12s = c15d + c14d; assign r12 = c12d ^ { r12s[24:0], r12s[31:25] }; assign r02s = r01 + c00d; assign r02 = c02d ^ { r02s[22:0], r02s[31:23] }; assign r07s = r06 + c05d; assign r07 = c07d ^ { r07s[22:0], r07s[31:23] }; assign r08s = r11 + c10d; assign r08 = c08d ^ { r08s[22:0], r08s[31:23] }; assign r13s = r12 + c15d; assign r13 = c13d ^ { r13s[22:0], r13s[31:23] }; assign r03s = r02 + r01; assign r03 = c03d ^ { r03s[18:0], r03s[31:19] }; assign r04s = r07 + r06; assign r04 = c04d ^ { r04s[18:0], r04s[31:19] }; assign r09s = r08 + r11; assign r09 = c09d ^ { r09s[18:0], r09s[31:19] }; assign r14s = r13 + r12; assign r14 = c14d ^ { r14s[18:0], r14s[31:19] }; assign r00s = r03 + r02; assign r00 = c00d ^ { r00s[13:0], r00s[31:14] }; assign r05s = r04 + r07; assign r05 = c05d ^ { r05s[13:0], r05s[31:14] }; assign r10s = r09 + r08; assign r10 = c10d ^ { r10s[13:0], r10s[31:14] }; assign r15s = r14 + r13; assign r15 = c15d ^ { r15s[13:0], r15s[31:14] }; wire [511:0]xo; // Rename row results assign xo = { r15, r14, r13, r12, r11, r10, r09, r08, r07, r06, r05, r04, r03, r02, r01, r00 }; assign Xaddr = xo[9:0]; // Unregistered output always @ (posedge clk) begin c00d <= c00; c01d <= c01; c02d <= c02; c03d <= c03; c04d <= c04; c05d <= c05; c06d <= c06; c07d <= c07; c08d <= c08; c09d <= c09; c10d <= c10; c11d <= c11; c12d <= c12; c13d <= c13; c14d <= c14; c15d <= c15; out <= xo; // Registered output end endmodule
module axi_protocol_converter_v2_1_axi3_conv # ( parameter C_FAMILY = "none", parameter integer C_AXI_ID_WIDTH = 1, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH = 32, parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, parameter integer C_AXI_AWUSER_WIDTH = 1, parameter integer C_AXI_ARUSER_WIDTH = 1, parameter integer C_AXI_WUSER_WIDTH = 1, parameter integer C_AXI_RUSER_WIDTH = 1, parameter integer C_AXI_BUSER_WIDTH = 1, parameter integer C_AXI_SUPPORTS_WRITE = 1, parameter integer C_AXI_SUPPORTS_READ = 1, parameter integer C_SUPPORT_SPLITTING = 1, // Implement transaction splitting logic. // Disabled whan all connected masters are AXI3 and have same or narrower data width. parameter integer C_SUPPORT_BURSTS = 1, // Disabled when all connected masters are AxiLite, // allowing logic to be simplified. parameter integer C_SINGLE_THREAD = 1 // 0 = Ignore ID when propagating transactions (assume all responses are in order). // 1 = Enforce single-threading (one ID at a time) when any outstanding or // requested transaction requires splitting. // While no split is ongoing any new non-split transaction will pass immediately regardless // off ID. // A split transaction will stall if there are multiple ID (non-split) transactions // ongoing, once it has been forwarded only transactions with the same ID is allowed // (split or not) until all ongoing split transactios has been completed. ) ( // System Signals input wire ACLK, input wire ARESETN, // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] S_AXI_AWID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_AWADDR, input wire [8-1:0] S_AXI_AWLEN, input wire [3-1:0] S_AXI_AWSIZE, input wire [2-1:0] S_AXI_AWBURST, input wire [1-1:0] S_AXI_AWLOCK, input wire [4-1:0] S_AXI_AWCACHE, input wire [3-1:0] S_AXI_AWPROT, input wire [4-1:0] S_AXI_AWQOS, input wire [C_AXI_AWUSER_WIDTH-1:0] S_AXI_AWUSER, input wire S_AXI_AWVALID, output wire S_AXI_AWREADY, // Slave Interface Write Data Ports input wire [C_AXI_DATA_WIDTH-1:0] S_AXI_WDATA, input wire [C_AXI_DATA_WIDTH/8-1:0] S_AXI_WSTRB, input wire S_AXI_WLAST, input wire [C_AXI_WUSER_WIDTH-1:0] S_AXI_WUSER, input wire S_AXI_WVALID, output wire S_AXI_WREADY, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] S_AXI_ARID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_ARADDR, input wire [8-1:0] S_AXI_ARLEN, input wire [3-1:0] S_AXI_ARSIZE, input wire [2-1:0] S_AXI_ARBURST, input wire [1-1:0] S_AXI_ARLOCK, input wire [4-1:0] S_AXI_ARCACHE, input wire [3-1:0] S_AXI_ARPROT, input wire [4-1:0] S_AXI_ARQOS, input wire [C_AXI_ARUSER_WIDTH-1:0] S_AXI_ARUSER, input wire S_AXI_ARVALID, output wire S_AXI_ARREADY, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_RID, output wire [C_AXI_DATA_WIDTH-1:0] S_AXI_RDATA, output wire [2-1:0] S_AXI_RRESP, output wire S_AXI_RLAST, output wire [C_AXI_RUSER_WIDTH-1:0] S_AXI_RUSER, output wire S_AXI_RVALID, input wire S_AXI_RREADY, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_AWID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_AWADDR, output wire [4-1:0] M_AXI_AWLEN, output wire [3-1:0] M_AXI_AWSIZE, output wire [2-1:0] M_AXI_AWBURST, output wire [2-1:0] M_AXI_AWLOCK, output wire [4-1:0] M_AXI_AWCACHE, output wire [3-1:0] M_AXI_AWPROT, output wire [4-1:0] M_AXI_AWQOS, output wire [C_AXI_AWUSER_WIDTH-1:0] M_AXI_AWUSER, output wire M_AXI_AWVALID, input wire M_AXI_AWREADY, // Master Interface Write Data Ports output wire [C_AXI_ID_WIDTH-1:0] M_AXI_WID, output wire [C_AXI_DATA_WIDTH-1:0] M_AXI_WDATA, output wire [C_AXI_DATA_WIDTH/8-1:0] M_AXI_WSTRB, output wire M_AXI_WLAST, output wire [C_AXI_WUSER_WIDTH-1:0] M_AXI_WUSER, output wire M_AXI_WVALID, input wire M_AXI_WREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY, // Master Interface Read Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_ARID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_ARADDR, output wire [4-1:0] M_AXI_ARLEN, output wire [3-1:0] M_AXI_ARSIZE, output wire [2-1:0] M_AXI_ARBURST, output wire [2-1:0] M_AXI_ARLOCK, output wire [4-1:0] M_AXI_ARCACHE, output wire [3-1:0] M_AXI_ARPROT, output wire [4-1:0] M_AXI_ARQOS, output wire [C_AXI_ARUSER_WIDTH-1:0] M_AXI_ARUSER, output wire M_AXI_ARVALID, input wire M_AXI_ARREADY, // Master Interface Read Data Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_RID, input wire [C_AXI_DATA_WIDTH-1:0] M_AXI_RDATA, input wire [2-1:0] M_AXI_RRESP, input wire M_AXI_RLAST, input wire [C_AXI_RUSER_WIDTH-1:0] M_AXI_RUSER, input wire M_AXI_RVALID, output wire M_AXI_RREADY ); ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Handle Write Channels (AW/W/B) ///////////////////////////////////////////////////////////////////////////// generate if (C_AXI_SUPPORTS_WRITE == 1) begin : USE_WRITE // Write Channel Signals for Commands Queue Interface. wire wr_cmd_valid; wire [C_AXI_ID_WIDTH-1:0] wr_cmd_id; wire [4-1:0] wr_cmd_length; wire wr_cmd_ready; wire wr_cmd_b_valid; wire wr_cmd_b_split; wire [4-1:0] wr_cmd_b_repeat; wire wr_cmd_b_ready; // Write Address Channel. axi_protocol_converter_v2_1_a_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_ADDR_WIDTH (C_AXI_ADDR_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_AUSER_WIDTH (C_AXI_AWUSER_WIDTH), .C_AXI_CHANNEL (0), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS), .C_SINGLE_THREAD (C_SINGLE_THREAD) ) write_addr_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface (W) .cmd_valid (wr_cmd_valid), .cmd_split (), .cmd_id (wr_cmd_id), .cmd_length (wr_cmd_length), .cmd_ready (wr_cmd_ready), // Command Interface (B) .cmd_b_valid (wr_cmd_b_valid), .cmd_b_split (wr_cmd_b_split), .cmd_b_repeat (wr_cmd_b_repeat), .cmd_b_ready (wr_cmd_b_ready), // Slave Interface Write Address Ports .S_AXI_AID (S_AXI_AWID), .S_AXI_AADDR (S_AXI_AWADDR), .S_AXI_ALEN (S_AXI_AWLEN), .S_AXI_ASIZE (S_AXI_AWSIZE), .S_AXI_ABURST (S_AXI_AWBURST), .S_AXI_ALOCK (S_AXI_AWLOCK), .S_AXI_ACACHE (S_AXI_AWCACHE), .S_AXI_APROT (S_AXI_AWPROT), .S_AXI_AQOS (S_AXI_AWQOS), .S_AXI_AUSER (S_AXI_AWUSER), .S_AXI_AVALID (S_AXI_AWVALID), .S_AXI_AREADY (S_AXI_AWREADY), // Master Interface Write Address Port .M_AXI_AID (M_AXI_AWID), .M_AXI_AADDR (M_AXI_AWADDR), .M_AXI_ALEN (M_AXI_AWLEN), .M_AXI_ASIZE (M_AXI_AWSIZE), .M_AXI_ABURST (M_AXI_AWBURST), .M_AXI_ALOCK (M_AXI_AWLOCK), .M_AXI_ACACHE (M_AXI_AWCACHE), .M_AXI_APROT (M_AXI_AWPROT), .M_AXI_AQOS (M_AXI_AWQOS), .M_AXI_AUSER (M_AXI_AWUSER), .M_AXI_AVALID (M_AXI_AWVALID), .M_AXI_AREADY (M_AXI_AWREADY) ); // Write Data Channel. axi_protocol_converter_v2_1_w_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_WUSER_WIDTH (C_AXI_WUSER_WIDTH), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS) ) write_data_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (wr_cmd_valid), .cmd_id (wr_cmd_id), .cmd_length (wr_cmd_length), .cmd_ready (wr_cmd_ready), // Slave Interface Write Data Ports .S_AXI_WDATA (S_AXI_WDATA), .S_AXI_WSTRB (S_AXI_WSTRB), .S_AXI_WLAST (S_AXI_WLAST), .S_AXI_WUSER (S_AXI_WUSER), .S_AXI_WVALID (S_AXI_WVALID), .S_AXI_WREADY (S_AXI_WREADY), // Master Interface Write Data Ports .M_AXI_WID (M_AXI_WID), .M_AXI_WDATA (M_AXI_WDATA), .M_AXI_WSTRB (M_AXI_WSTRB), .M_AXI_WLAST (M_AXI_WLAST), .M_AXI_WUSER (M_AXI_WUSER), .M_AXI_WVALID (M_AXI_WVALID), .M_AXI_WREADY (M_AXI_WREADY) ); if ( C_SUPPORT_SPLITTING == 1 && C_SUPPORT_BURSTS == 1 ) begin : USE_SPLIT_W // Write Data Response Channel. axi_protocol_converter_v2_1_b_downsizer # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_BUSER_WIDTH (C_AXI_BUSER_WIDTH) ) write_resp_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (wr_cmd_b_valid), .cmd_split (wr_cmd_b_split), .cmd_repeat (wr_cmd_b_repeat), .cmd_ready (wr_cmd_b_ready), // Slave Interface Write Response Ports .S_AXI_BID (S_AXI_BID), .S_AXI_BRESP (S_AXI_BRESP), .S_AXI_BUSER (S_AXI_BUSER), .S_AXI_BVALID (S_AXI_BVALID), .S_AXI_BREADY (S_AXI_BREADY), // Master Interface Write Response Ports .M_AXI_BID (M_AXI_BID), .M_AXI_BRESP (M_AXI_BRESP), .M_AXI_BUSER (M_AXI_BUSER), .M_AXI_BVALID (M_AXI_BVALID), .M_AXI_BREADY (M_AXI_BREADY) ); end else begin : NO_SPLIT_W // MI -> SI Interface Write Response Ports assign S_AXI_BID = M_AXI_BID; assign S_AXI_BRESP = M_AXI_BRESP; assign S_AXI_BUSER = M_AXI_BUSER; assign S_AXI_BVALID = M_AXI_BVALID; assign M_AXI_BREADY = S_AXI_BREADY; end end else begin : NO_WRITE // Slave Interface Write Address Ports assign S_AXI_AWREADY = 1'b0; // Slave Interface Write Data Ports assign S_AXI_WREADY = 1'b0; // Slave Interface Write Response Ports assign S_AXI_BID = {C_AXI_ID_WIDTH{1'b0}}; assign S_AXI_BRESP = 2'b0; assign S_AXI_BUSER = {C_AXI_BUSER_WIDTH{1'b0}}; assign S_AXI_BVALID = 1'b0; // Master Interface Write Address Port assign M_AXI_AWID = {C_AXI_ID_WIDTH{1'b0}}; assign M_AXI_AWADDR = {C_AXI_ADDR_WIDTH{1'b0}}; assign M_AXI_AWLEN = 4'b0; assign M_AXI_AWSIZE = 3'b0; assign M_AXI_AWBURST = 2'b0; assign M_AXI_AWLOCK = 2'b0; assign M_AXI_AWCACHE = 4'b0; assign M_AXI_AWPROT = 3'b0; assign M_AXI_AWQOS = 4'b0; assign M_AXI_AWUSER = {C_AXI_AWUSER_WIDTH{1'b0}}; assign M_AXI_AWVALID = 1'b0; // Master Interface Write Data Ports assign M_AXI_WDATA = {C_AXI_DATA_WIDTH{1'b0}}; assign M_AXI_WSTRB = {C_AXI_DATA_WIDTH/8{1'b0}}; assign M_AXI_WLAST = 1'b0; assign M_AXI_WUSER = {C_AXI_WUSER_WIDTH{1'b0}}; assign M_AXI_WVALID = 1'b0; // Master Interface Write Response Ports assign M_AXI_BREADY = 1'b0; end endgenerate ///////////////////////////////////////////////////////////////////////////// // Handle Read Channels (AR/R) ///////////////////////////////////////////////////////////////////////////// generate if (C_AXI_SUPPORTS_READ == 1) begin : USE_READ // Write Response channel. if ( C_SUPPORT_SPLITTING == 1 && C_SUPPORT_BURSTS == 1 ) begin : USE_SPLIT_R // Read Channel Signals for Commands Queue Interface. wire rd_cmd_valid; wire rd_cmd_split; wire rd_cmd_ready; // Write Address Channel. axi_protocol_converter_v2_1_a_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_ADDR_WIDTH (C_AXI_ADDR_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_AUSER_WIDTH (C_AXI_ARUSER_WIDTH), .C_AXI_CHANNEL (1), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS), .C_SINGLE_THREAD (C_SINGLE_THREAD) ) read_addr_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface (R) .cmd_valid (rd_cmd_valid), .cmd_split (rd_cmd_split), .cmd_id (), .cmd_length (), .cmd_ready (rd_cmd_ready), // Command Interface (B) .cmd_b_valid (), .cmd_b_split (), .cmd_b_repeat (), .cmd_b_ready (1'b0), // Slave Interface Write Address Ports .S_AXI_AID (S_AXI_ARID), .S_AXI_AADDR (S_AXI_ARADDR), .S_AXI_ALEN (S_AXI_ARLEN), .S_AXI_ASIZE (S_AXI_ARSIZE), .S_AXI_ABURST (S_AXI_ARBURST), .S_AXI_ALOCK (S_AXI_ARLOCK), .S_AXI_ACACHE (S_AXI_ARCACHE), .S_AXI_APROT (S_AXI_ARPROT), .S_AXI_AQOS (S_AXI_ARQOS), .S_AXI_AUSER (S_AXI_ARUSER), .S_AXI_AVALID (S_AXI_ARVALID), .S_AXI_AREADY (S_AXI_ARREADY), // Master Interface Write Address Port .M_AXI_AID (M_AXI_ARID), .M_AXI_AADDR (M_AXI_ARADDR), .M_AXI_ALEN (M_AXI_ARLEN), .M_AXI_ASIZE (M_AXI_ARSIZE), .M_AXI_ABURST (M_AXI_ARBURST), .M_AXI_ALOCK (M_AXI_ARLOCK), .M_AXI_ACACHE (M_AXI_ARCACHE), .M_AXI_APROT (M_AXI_ARPROT), .M_AXI_AQOS (M_AXI_ARQOS), .M_AXI_AUSER (M_AXI_ARUSER), .M_AXI_AVALID (M_AXI_ARVALID), .M_AXI_AREADY (M_AXI_ARREADY) ); // Read Data Channel. axi_protocol_converter_v2_1_r_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_RUSER_WIDTH (C_AXI_RUSER_WIDTH), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS) ) read_data_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (rd_cmd_valid), .cmd_split (rd_cmd_split), .cmd_ready (rd_cmd_ready), // Slave Interface Read Data Ports .S_AXI_RID (S_AXI_RID), .S_AXI_RDATA (S_AXI_RDATA), .S_AXI_RRESP (S_AXI_RRESP), .S_AXI_RLAST (S_AXI_RLAST), .S_AXI_RUSER (S_AXI_RUSER), .S_AXI_RVALID (S_AXI_RVALID), .S_AXI_RREADY (S_AXI_RREADY), // Master Interface Read Data Ports .M_AXI_RID (M_AXI_RID), .M_AXI_RDATA (M_AXI_RDATA), .M_AXI_RRESP (M_AXI_RRESP), .M_AXI_RLAST (M_AXI_RLAST), .M_AXI_RUSER (M_AXI_RUSER), .M_AXI_RVALID (M_AXI_RVALID), .M_AXI_RREADY (M_AXI_RREADY) ); end else begin : NO_SPLIT_R // SI -> MI Interface Write Address Port assign M_AXI_ARID = S_AXI_ARID; assign M_AXI_ARADDR = S_AXI_ARADDR; assign M_AXI_ARLEN = S_AXI_ARLEN; assign M_AXI_ARSIZE = S_AXI_ARSIZE; assign M_AXI_ARBURST = S_AXI_ARBURST; assign M_AXI_ARLOCK = S_AXI_ARLOCK; assign M_AXI_ARCACHE = S_AXI_ARCACHE; assign M_AXI_ARPROT = S_AXI_ARPROT; assign M_AXI_ARQOS = S_AXI_ARQOS; assign M_AXI_ARUSER = S_AXI_ARUSER; assign M_AXI_ARVALID = S_AXI_ARVALID; assign S_AXI_ARREADY = M_AXI_ARREADY; // MI -> SI Interface Read Data Ports assign S_AXI_RID = M_AXI_RID; assign S_AXI_RDATA = M_AXI_RDATA; assign S_AXI_RRESP = M_AXI_RRESP; assign S_AXI_RLAST = M_AXI_RLAST; assign S_AXI_RUSER = M_AXI_RUSER; assign S_AXI_RVALID = M_AXI_RVALID; assign M_AXI_RREADY = S_AXI_RREADY; end end else begin : NO_READ // Slave Interface Read Address Ports assign S_AXI_ARREADY = 1'b0; // Slave Interface Read Data Ports assign S_AXI_RID = {C_AXI_ID_WIDTH{1'b0}}; assign S_AXI_RDATA = {C_AXI_DATA_WIDTH{1'b0}}; assign S_AXI_RRESP = 2'b0; assign S_AXI_RLAST = 1'b0; assign S_AXI_RUSER = {C_AXI_RUSER_WIDTH{1'b0}}; assign S_AXI_RVALID = 1'b0; // Master Interface Read Address Port assign M_AXI_ARID = {C_AXI_ID_WIDTH{1'b0}}; assign M_AXI_ARADDR = {C_AXI_ADDR_WIDTH{1'b0}}; assign M_AXI_ARLEN = 4'b0; assign M_AXI_ARSIZE = 3'b0; assign M_AXI_ARBURST = 2'b0; assign M_AXI_ARLOCK = 2'b0; assign M_AXI_ARCACHE = 4'b0; assign M_AXI_ARPROT = 3'b0; assign M_AXI_ARQOS = 4'b0; assign M_AXI_ARUSER = {C_AXI_ARUSER_WIDTH{1'b0}}; assign M_AXI_ARVALID = 1'b0; // Master Interface Read Data Ports assign M_AXI_RREADY = 1'b0; end endgenerate endmodule
module axi_protocol_converter_v2_1_axi3_conv # ( parameter C_FAMILY = "none", parameter integer C_AXI_ID_WIDTH = 1, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH = 32, parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, parameter integer C_AXI_AWUSER_WIDTH = 1, parameter integer C_AXI_ARUSER_WIDTH = 1, parameter integer C_AXI_WUSER_WIDTH = 1, parameter integer C_AXI_RUSER_WIDTH = 1, parameter integer C_AXI_BUSER_WIDTH = 1, parameter integer C_AXI_SUPPORTS_WRITE = 1, parameter integer C_AXI_SUPPORTS_READ = 1, parameter integer C_SUPPORT_SPLITTING = 1, // Implement transaction splitting logic. // Disabled whan all connected masters are AXI3 and have same or narrower data width. parameter integer C_SUPPORT_BURSTS = 1, // Disabled when all connected masters are AxiLite, // allowing logic to be simplified. parameter integer C_SINGLE_THREAD = 1 // 0 = Ignore ID when propagating transactions (assume all responses are in order). // 1 = Enforce single-threading (one ID at a time) when any outstanding or // requested transaction requires splitting. // While no split is ongoing any new non-split transaction will pass immediately regardless // off ID. // A split transaction will stall if there are multiple ID (non-split) transactions // ongoing, once it has been forwarded only transactions with the same ID is allowed // (split or not) until all ongoing split transactios has been completed. ) ( // System Signals input wire ACLK, input wire ARESETN, // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] S_AXI_AWID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_AWADDR, input wire [8-1:0] S_AXI_AWLEN, input wire [3-1:0] S_AXI_AWSIZE, input wire [2-1:0] S_AXI_AWBURST, input wire [1-1:0] S_AXI_AWLOCK, input wire [4-1:0] S_AXI_AWCACHE, input wire [3-1:0] S_AXI_AWPROT, input wire [4-1:0] S_AXI_AWQOS, input wire [C_AXI_AWUSER_WIDTH-1:0] S_AXI_AWUSER, input wire S_AXI_AWVALID, output wire S_AXI_AWREADY, // Slave Interface Write Data Ports input wire [C_AXI_DATA_WIDTH-1:0] S_AXI_WDATA, input wire [C_AXI_DATA_WIDTH/8-1:0] S_AXI_WSTRB, input wire S_AXI_WLAST, input wire [C_AXI_WUSER_WIDTH-1:0] S_AXI_WUSER, input wire S_AXI_WVALID, output wire S_AXI_WREADY, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] S_AXI_ARID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_ARADDR, input wire [8-1:0] S_AXI_ARLEN, input wire [3-1:0] S_AXI_ARSIZE, input wire [2-1:0] S_AXI_ARBURST, input wire [1-1:0] S_AXI_ARLOCK, input wire [4-1:0] S_AXI_ARCACHE, input wire [3-1:0] S_AXI_ARPROT, input wire [4-1:0] S_AXI_ARQOS, input wire [C_AXI_ARUSER_WIDTH-1:0] S_AXI_ARUSER, input wire S_AXI_ARVALID, output wire S_AXI_ARREADY, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_RID, output wire [C_AXI_DATA_WIDTH-1:0] S_AXI_RDATA, output wire [2-1:0] S_AXI_RRESP, output wire S_AXI_RLAST, output wire [C_AXI_RUSER_WIDTH-1:0] S_AXI_RUSER, output wire S_AXI_RVALID, input wire S_AXI_RREADY, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_AWID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_AWADDR, output wire [4-1:0] M_AXI_AWLEN, output wire [3-1:0] M_AXI_AWSIZE, output wire [2-1:0] M_AXI_AWBURST, output wire [2-1:0] M_AXI_AWLOCK, output wire [4-1:0] M_AXI_AWCACHE, output wire [3-1:0] M_AXI_AWPROT, output wire [4-1:0] M_AXI_AWQOS, output wire [C_AXI_AWUSER_WIDTH-1:0] M_AXI_AWUSER, output wire M_AXI_AWVALID, input wire M_AXI_AWREADY, // Master Interface Write Data Ports output wire [C_AXI_ID_WIDTH-1:0] M_AXI_WID, output wire [C_AXI_DATA_WIDTH-1:0] M_AXI_WDATA, output wire [C_AXI_DATA_WIDTH/8-1:0] M_AXI_WSTRB, output wire M_AXI_WLAST, output wire [C_AXI_WUSER_WIDTH-1:0] M_AXI_WUSER, output wire M_AXI_WVALID, input wire M_AXI_WREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY, // Master Interface Read Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_ARID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_ARADDR, output wire [4-1:0] M_AXI_ARLEN, output wire [3-1:0] M_AXI_ARSIZE, output wire [2-1:0] M_AXI_ARBURST, output wire [2-1:0] M_AXI_ARLOCK, output wire [4-1:0] M_AXI_ARCACHE, output wire [3-1:0] M_AXI_ARPROT, output wire [4-1:0] M_AXI_ARQOS, output wire [C_AXI_ARUSER_WIDTH-1:0] M_AXI_ARUSER, output wire M_AXI_ARVALID, input wire M_AXI_ARREADY, // Master Interface Read Data Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_RID, input wire [C_AXI_DATA_WIDTH-1:0] M_AXI_RDATA, input wire [2-1:0] M_AXI_RRESP, input wire M_AXI_RLAST, input wire [C_AXI_RUSER_WIDTH-1:0] M_AXI_RUSER, input wire M_AXI_RVALID, output wire M_AXI_RREADY ); ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Handle Write Channels (AW/W/B) ///////////////////////////////////////////////////////////////////////////// generate if (C_AXI_SUPPORTS_WRITE == 1) begin : USE_WRITE // Write Channel Signals for Commands Queue Interface. wire wr_cmd_valid; wire [C_AXI_ID_WIDTH-1:0] wr_cmd_id; wire [4-1:0] wr_cmd_length; wire wr_cmd_ready; wire wr_cmd_b_valid; wire wr_cmd_b_split; wire [4-1:0] wr_cmd_b_repeat; wire wr_cmd_b_ready; // Write Address Channel. axi_protocol_converter_v2_1_a_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_ADDR_WIDTH (C_AXI_ADDR_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_AUSER_WIDTH (C_AXI_AWUSER_WIDTH), .C_AXI_CHANNEL (0), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS), .C_SINGLE_THREAD (C_SINGLE_THREAD) ) write_addr_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface (W) .cmd_valid (wr_cmd_valid), .cmd_split (), .cmd_id (wr_cmd_id), .cmd_length (wr_cmd_length), .cmd_ready (wr_cmd_ready), // Command Interface (B) .cmd_b_valid (wr_cmd_b_valid), .cmd_b_split (wr_cmd_b_split), .cmd_b_repeat (wr_cmd_b_repeat), .cmd_b_ready (wr_cmd_b_ready), // Slave Interface Write Address Ports .S_AXI_AID (S_AXI_AWID), .S_AXI_AADDR (S_AXI_AWADDR), .S_AXI_ALEN (S_AXI_AWLEN), .S_AXI_ASIZE (S_AXI_AWSIZE), .S_AXI_ABURST (S_AXI_AWBURST), .S_AXI_ALOCK (S_AXI_AWLOCK), .S_AXI_ACACHE (S_AXI_AWCACHE), .S_AXI_APROT (S_AXI_AWPROT), .S_AXI_AQOS (S_AXI_AWQOS), .S_AXI_AUSER (S_AXI_AWUSER), .S_AXI_AVALID (S_AXI_AWVALID), .S_AXI_AREADY (S_AXI_AWREADY), // Master Interface Write Address Port .M_AXI_AID (M_AXI_AWID), .M_AXI_AADDR (M_AXI_AWADDR), .M_AXI_ALEN (M_AXI_AWLEN), .M_AXI_ASIZE (M_AXI_AWSIZE), .M_AXI_ABURST (M_AXI_AWBURST), .M_AXI_ALOCK (M_AXI_AWLOCK), .M_AXI_ACACHE (M_AXI_AWCACHE), .M_AXI_APROT (M_AXI_AWPROT), .M_AXI_AQOS (M_AXI_AWQOS), .M_AXI_AUSER (M_AXI_AWUSER), .M_AXI_AVALID (M_AXI_AWVALID), .M_AXI_AREADY (M_AXI_AWREADY) ); // Write Data Channel. axi_protocol_converter_v2_1_w_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_WUSER_WIDTH (C_AXI_WUSER_WIDTH), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS) ) write_data_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (wr_cmd_valid), .cmd_id (wr_cmd_id), .cmd_length (wr_cmd_length), .cmd_ready (wr_cmd_ready), // Slave Interface Write Data Ports .S_AXI_WDATA (S_AXI_WDATA), .S_AXI_WSTRB (S_AXI_WSTRB), .S_AXI_WLAST (S_AXI_WLAST), .S_AXI_WUSER (S_AXI_WUSER), .S_AXI_WVALID (S_AXI_WVALID), .S_AXI_WREADY (S_AXI_WREADY), // Master Interface Write Data Ports .M_AXI_WID (M_AXI_WID), .M_AXI_WDATA (M_AXI_WDATA), .M_AXI_WSTRB (M_AXI_WSTRB), .M_AXI_WLAST (M_AXI_WLAST), .M_AXI_WUSER (M_AXI_WUSER), .M_AXI_WVALID (M_AXI_WVALID), .M_AXI_WREADY (M_AXI_WREADY) ); if ( C_SUPPORT_SPLITTING == 1 && C_SUPPORT_BURSTS == 1 ) begin : USE_SPLIT_W // Write Data Response Channel. axi_protocol_converter_v2_1_b_downsizer # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_BUSER_WIDTH (C_AXI_BUSER_WIDTH) ) write_resp_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (wr_cmd_b_valid), .cmd_split (wr_cmd_b_split), .cmd_repeat (wr_cmd_b_repeat), .cmd_ready (wr_cmd_b_ready), // Slave Interface Write Response Ports .S_AXI_BID (S_AXI_BID), .S_AXI_BRESP (S_AXI_BRESP), .S_AXI_BUSER (S_AXI_BUSER), .S_AXI_BVALID (S_AXI_BVALID), .S_AXI_BREADY (S_AXI_BREADY), // Master Interface Write Response Ports .M_AXI_BID (M_AXI_BID), .M_AXI_BRESP (M_AXI_BRESP), .M_AXI_BUSER (M_AXI_BUSER), .M_AXI_BVALID (M_AXI_BVALID), .M_AXI_BREADY (M_AXI_BREADY) ); end else begin : NO_SPLIT_W // MI -> SI Interface Write Response Ports assign S_AXI_BID = M_AXI_BID; assign S_AXI_BRESP = M_AXI_BRESP; assign S_AXI_BUSER = M_AXI_BUSER; assign S_AXI_BVALID = M_AXI_BVALID; assign M_AXI_BREADY = S_AXI_BREADY; end end else begin : NO_WRITE // Slave Interface Write Address Ports assign S_AXI_AWREADY = 1'b0; // Slave Interface Write Data Ports assign S_AXI_WREADY = 1'b0; // Slave Interface Write Response Ports assign S_AXI_BID = {C_AXI_ID_WIDTH{1'b0}}; assign S_AXI_BRESP = 2'b0; assign S_AXI_BUSER = {C_AXI_BUSER_WIDTH{1'b0}}; assign S_AXI_BVALID = 1'b0; // Master Interface Write Address Port assign M_AXI_AWID = {C_AXI_ID_WIDTH{1'b0}}; assign M_AXI_AWADDR = {C_AXI_ADDR_WIDTH{1'b0}}; assign M_AXI_AWLEN = 4'b0; assign M_AXI_AWSIZE = 3'b0; assign M_AXI_AWBURST = 2'b0; assign M_AXI_AWLOCK = 2'b0; assign M_AXI_AWCACHE = 4'b0; assign M_AXI_AWPROT = 3'b0; assign M_AXI_AWQOS = 4'b0; assign M_AXI_AWUSER = {C_AXI_AWUSER_WIDTH{1'b0}}; assign M_AXI_AWVALID = 1'b0; // Master Interface Write Data Ports assign M_AXI_WDATA = {C_AXI_DATA_WIDTH{1'b0}}; assign M_AXI_WSTRB = {C_AXI_DATA_WIDTH/8{1'b0}}; assign M_AXI_WLAST = 1'b0; assign M_AXI_WUSER = {C_AXI_WUSER_WIDTH{1'b0}}; assign M_AXI_WVALID = 1'b0; // Master Interface Write Response Ports assign M_AXI_BREADY = 1'b0; end endgenerate ///////////////////////////////////////////////////////////////////////////// // Handle Read Channels (AR/R) ///////////////////////////////////////////////////////////////////////////// generate if (C_AXI_SUPPORTS_READ == 1) begin : USE_READ // Write Response channel. if ( C_SUPPORT_SPLITTING == 1 && C_SUPPORT_BURSTS == 1 ) begin : USE_SPLIT_R // Read Channel Signals for Commands Queue Interface. wire rd_cmd_valid; wire rd_cmd_split; wire rd_cmd_ready; // Write Address Channel. axi_protocol_converter_v2_1_a_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_ADDR_WIDTH (C_AXI_ADDR_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_AUSER_WIDTH (C_AXI_ARUSER_WIDTH), .C_AXI_CHANNEL (1), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS), .C_SINGLE_THREAD (C_SINGLE_THREAD) ) read_addr_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface (R) .cmd_valid (rd_cmd_valid), .cmd_split (rd_cmd_split), .cmd_id (), .cmd_length (), .cmd_ready (rd_cmd_ready), // Command Interface (B) .cmd_b_valid (), .cmd_b_split (), .cmd_b_repeat (), .cmd_b_ready (1'b0), // Slave Interface Write Address Ports .S_AXI_AID (S_AXI_ARID), .S_AXI_AADDR (S_AXI_ARADDR), .S_AXI_ALEN (S_AXI_ARLEN), .S_AXI_ASIZE (S_AXI_ARSIZE), .S_AXI_ABURST (S_AXI_ARBURST), .S_AXI_ALOCK (S_AXI_ARLOCK), .S_AXI_ACACHE (S_AXI_ARCACHE), .S_AXI_APROT (S_AXI_ARPROT), .S_AXI_AQOS (S_AXI_ARQOS), .S_AXI_AUSER (S_AXI_ARUSER), .S_AXI_AVALID (S_AXI_ARVALID), .S_AXI_AREADY (S_AXI_ARREADY), // Master Interface Write Address Port .M_AXI_AID (M_AXI_ARID), .M_AXI_AADDR (M_AXI_ARADDR), .M_AXI_ALEN (M_AXI_ARLEN), .M_AXI_ASIZE (M_AXI_ARSIZE), .M_AXI_ABURST (M_AXI_ARBURST), .M_AXI_ALOCK (M_AXI_ARLOCK), .M_AXI_ACACHE (M_AXI_ARCACHE), .M_AXI_APROT (M_AXI_ARPROT), .M_AXI_AQOS (M_AXI_ARQOS), .M_AXI_AUSER (M_AXI_ARUSER), .M_AXI_AVALID (M_AXI_ARVALID), .M_AXI_AREADY (M_AXI_ARREADY) ); // Read Data Channel. axi_protocol_converter_v2_1_r_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_RUSER_WIDTH (C_AXI_RUSER_WIDTH), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS) ) read_data_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (rd_cmd_valid), .cmd_split (rd_cmd_split), .cmd_ready (rd_cmd_ready), // Slave Interface Read Data Ports .S_AXI_RID (S_AXI_RID), .S_AXI_RDATA (S_AXI_RDATA), .S_AXI_RRESP (S_AXI_RRESP), .S_AXI_RLAST (S_AXI_RLAST), .S_AXI_RUSER (S_AXI_RUSER), .S_AXI_RVALID (S_AXI_RVALID), .S_AXI_RREADY (S_AXI_RREADY), // Master Interface Read Data Ports .M_AXI_RID (M_AXI_RID), .M_AXI_RDATA (M_AXI_RDATA), .M_AXI_RRESP (M_AXI_RRESP), .M_AXI_RLAST (M_AXI_RLAST), .M_AXI_RUSER (M_AXI_RUSER), .M_AXI_RVALID (M_AXI_RVALID), .M_AXI_RREADY (M_AXI_RREADY) ); end else begin : NO_SPLIT_R // SI -> MI Interface Write Address Port assign M_AXI_ARID = S_AXI_ARID; assign M_AXI_ARADDR = S_AXI_ARADDR; assign M_AXI_ARLEN = S_AXI_ARLEN; assign M_AXI_ARSIZE = S_AXI_ARSIZE; assign M_AXI_ARBURST = S_AXI_ARBURST; assign M_AXI_ARLOCK = S_AXI_ARLOCK; assign M_AXI_ARCACHE = S_AXI_ARCACHE; assign M_AXI_ARPROT = S_AXI_ARPROT; assign M_AXI_ARQOS = S_AXI_ARQOS; assign M_AXI_ARUSER = S_AXI_ARUSER; assign M_AXI_ARVALID = S_AXI_ARVALID; assign S_AXI_ARREADY = M_AXI_ARREADY; // MI -> SI Interface Read Data Ports assign S_AXI_RID = M_AXI_RID; assign S_AXI_RDATA = M_AXI_RDATA; assign S_AXI_RRESP = M_AXI_RRESP; assign S_AXI_RLAST = M_AXI_RLAST; assign S_AXI_RUSER = M_AXI_RUSER; assign S_AXI_RVALID = M_AXI_RVALID; assign M_AXI_RREADY = S_AXI_RREADY; end end else begin : NO_READ // Slave Interface Read Address Ports assign S_AXI_ARREADY = 1'b0; // Slave Interface Read Data Ports assign S_AXI_RID = {C_AXI_ID_WIDTH{1'b0}}; assign S_AXI_RDATA = {C_AXI_DATA_WIDTH{1'b0}}; assign S_AXI_RRESP = 2'b0; assign S_AXI_RLAST = 1'b0; assign S_AXI_RUSER = {C_AXI_RUSER_WIDTH{1'b0}}; assign S_AXI_RVALID = 1'b0; // Master Interface Read Address Port assign M_AXI_ARID = {C_AXI_ID_WIDTH{1'b0}}; assign M_AXI_ARADDR = {C_AXI_ADDR_WIDTH{1'b0}}; assign M_AXI_ARLEN = 4'b0; assign M_AXI_ARSIZE = 3'b0; assign M_AXI_ARBURST = 2'b0; assign M_AXI_ARLOCK = 2'b0; assign M_AXI_ARCACHE = 4'b0; assign M_AXI_ARPROT = 3'b0; assign M_AXI_ARQOS = 4'b0; assign M_AXI_ARUSER = {C_AXI_ARUSER_WIDTH{1'b0}}; assign M_AXI_ARVALID = 1'b0; // Master Interface Read Data Ports assign M_AXI_RREADY = 1'b0; end endgenerate endmodule
module axi_protocol_converter_v2_1_axi3_conv # ( parameter C_FAMILY = "none", parameter integer C_AXI_ID_WIDTH = 1, parameter integer C_AXI_ADDR_WIDTH = 32, parameter integer C_AXI_DATA_WIDTH = 32, parameter integer C_AXI_SUPPORTS_USER_SIGNALS = 0, parameter integer C_AXI_AWUSER_WIDTH = 1, parameter integer C_AXI_ARUSER_WIDTH = 1, parameter integer C_AXI_WUSER_WIDTH = 1, parameter integer C_AXI_RUSER_WIDTH = 1, parameter integer C_AXI_BUSER_WIDTH = 1, parameter integer C_AXI_SUPPORTS_WRITE = 1, parameter integer C_AXI_SUPPORTS_READ = 1, parameter integer C_SUPPORT_SPLITTING = 1, // Implement transaction splitting logic. // Disabled whan all connected masters are AXI3 and have same or narrower data width. parameter integer C_SUPPORT_BURSTS = 1, // Disabled when all connected masters are AxiLite, // allowing logic to be simplified. parameter integer C_SINGLE_THREAD = 1 // 0 = Ignore ID when propagating transactions (assume all responses are in order). // 1 = Enforce single-threading (one ID at a time) when any outstanding or // requested transaction requires splitting. // While no split is ongoing any new non-split transaction will pass immediately regardless // off ID. // A split transaction will stall if there are multiple ID (non-split) transactions // ongoing, once it has been forwarded only transactions with the same ID is allowed // (split or not) until all ongoing split transactios has been completed. ) ( // System Signals input wire ACLK, input wire ARESETN, // Slave Interface Write Address Ports input wire [C_AXI_ID_WIDTH-1:0] S_AXI_AWID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_AWADDR, input wire [8-1:0] S_AXI_AWLEN, input wire [3-1:0] S_AXI_AWSIZE, input wire [2-1:0] S_AXI_AWBURST, input wire [1-1:0] S_AXI_AWLOCK, input wire [4-1:0] S_AXI_AWCACHE, input wire [3-1:0] S_AXI_AWPROT, input wire [4-1:0] S_AXI_AWQOS, input wire [C_AXI_AWUSER_WIDTH-1:0] S_AXI_AWUSER, input wire S_AXI_AWVALID, output wire S_AXI_AWREADY, // Slave Interface Write Data Ports input wire [C_AXI_DATA_WIDTH-1:0] S_AXI_WDATA, input wire [C_AXI_DATA_WIDTH/8-1:0] S_AXI_WSTRB, input wire S_AXI_WLAST, input wire [C_AXI_WUSER_WIDTH-1:0] S_AXI_WUSER, input wire S_AXI_WVALID, output wire S_AXI_WREADY, // Slave Interface Write Response Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_BID, output wire [2-1:0] S_AXI_BRESP, output wire [C_AXI_BUSER_WIDTH-1:0] S_AXI_BUSER, output wire S_AXI_BVALID, input wire S_AXI_BREADY, // Slave Interface Read Address Ports input wire [C_AXI_ID_WIDTH-1:0] S_AXI_ARID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_ARADDR, input wire [8-1:0] S_AXI_ARLEN, input wire [3-1:0] S_AXI_ARSIZE, input wire [2-1:0] S_AXI_ARBURST, input wire [1-1:0] S_AXI_ARLOCK, input wire [4-1:0] S_AXI_ARCACHE, input wire [3-1:0] S_AXI_ARPROT, input wire [4-1:0] S_AXI_ARQOS, input wire [C_AXI_ARUSER_WIDTH-1:0] S_AXI_ARUSER, input wire S_AXI_ARVALID, output wire S_AXI_ARREADY, // Slave Interface Read Data Ports output wire [C_AXI_ID_WIDTH-1:0] S_AXI_RID, output wire [C_AXI_DATA_WIDTH-1:0] S_AXI_RDATA, output wire [2-1:0] S_AXI_RRESP, output wire S_AXI_RLAST, output wire [C_AXI_RUSER_WIDTH-1:0] S_AXI_RUSER, output wire S_AXI_RVALID, input wire S_AXI_RREADY, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_AWID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_AWADDR, output wire [4-1:0] M_AXI_AWLEN, output wire [3-1:0] M_AXI_AWSIZE, output wire [2-1:0] M_AXI_AWBURST, output wire [2-1:0] M_AXI_AWLOCK, output wire [4-1:0] M_AXI_AWCACHE, output wire [3-1:0] M_AXI_AWPROT, output wire [4-1:0] M_AXI_AWQOS, output wire [C_AXI_AWUSER_WIDTH-1:0] M_AXI_AWUSER, output wire M_AXI_AWVALID, input wire M_AXI_AWREADY, // Master Interface Write Data Ports output wire [C_AXI_ID_WIDTH-1:0] M_AXI_WID, output wire [C_AXI_DATA_WIDTH-1:0] M_AXI_WDATA, output wire [C_AXI_DATA_WIDTH/8-1:0] M_AXI_WSTRB, output wire M_AXI_WLAST, output wire [C_AXI_WUSER_WIDTH-1:0] M_AXI_WUSER, output wire M_AXI_WVALID, input wire M_AXI_WREADY, // Master Interface Write Response Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_BID, input wire [2-1:0] M_AXI_BRESP, input wire [C_AXI_BUSER_WIDTH-1:0] M_AXI_BUSER, input wire M_AXI_BVALID, output wire M_AXI_BREADY, // Master Interface Read Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_ARID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_ARADDR, output wire [4-1:0] M_AXI_ARLEN, output wire [3-1:0] M_AXI_ARSIZE, output wire [2-1:0] M_AXI_ARBURST, output wire [2-1:0] M_AXI_ARLOCK, output wire [4-1:0] M_AXI_ARCACHE, output wire [3-1:0] M_AXI_ARPROT, output wire [4-1:0] M_AXI_ARQOS, output wire [C_AXI_ARUSER_WIDTH-1:0] M_AXI_ARUSER, output wire M_AXI_ARVALID, input wire M_AXI_ARREADY, // Master Interface Read Data Ports input wire [C_AXI_ID_WIDTH-1:0] M_AXI_RID, input wire [C_AXI_DATA_WIDTH-1:0] M_AXI_RDATA, input wire [2-1:0] M_AXI_RRESP, input wire M_AXI_RLAST, input wire [C_AXI_RUSER_WIDTH-1:0] M_AXI_RUSER, input wire M_AXI_RVALID, output wire M_AXI_RREADY ); ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Handle Write Channels (AW/W/B) ///////////////////////////////////////////////////////////////////////////// generate if (C_AXI_SUPPORTS_WRITE == 1) begin : USE_WRITE // Write Channel Signals for Commands Queue Interface. wire wr_cmd_valid; wire [C_AXI_ID_WIDTH-1:0] wr_cmd_id; wire [4-1:0] wr_cmd_length; wire wr_cmd_ready; wire wr_cmd_b_valid; wire wr_cmd_b_split; wire [4-1:0] wr_cmd_b_repeat; wire wr_cmd_b_ready; // Write Address Channel. axi_protocol_converter_v2_1_a_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_ADDR_WIDTH (C_AXI_ADDR_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_AUSER_WIDTH (C_AXI_AWUSER_WIDTH), .C_AXI_CHANNEL (0), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS), .C_SINGLE_THREAD (C_SINGLE_THREAD) ) write_addr_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface (W) .cmd_valid (wr_cmd_valid), .cmd_split (), .cmd_id (wr_cmd_id), .cmd_length (wr_cmd_length), .cmd_ready (wr_cmd_ready), // Command Interface (B) .cmd_b_valid (wr_cmd_b_valid), .cmd_b_split (wr_cmd_b_split), .cmd_b_repeat (wr_cmd_b_repeat), .cmd_b_ready (wr_cmd_b_ready), // Slave Interface Write Address Ports .S_AXI_AID (S_AXI_AWID), .S_AXI_AADDR (S_AXI_AWADDR), .S_AXI_ALEN (S_AXI_AWLEN), .S_AXI_ASIZE (S_AXI_AWSIZE), .S_AXI_ABURST (S_AXI_AWBURST), .S_AXI_ALOCK (S_AXI_AWLOCK), .S_AXI_ACACHE (S_AXI_AWCACHE), .S_AXI_APROT (S_AXI_AWPROT), .S_AXI_AQOS (S_AXI_AWQOS), .S_AXI_AUSER (S_AXI_AWUSER), .S_AXI_AVALID (S_AXI_AWVALID), .S_AXI_AREADY (S_AXI_AWREADY), // Master Interface Write Address Port .M_AXI_AID (M_AXI_AWID), .M_AXI_AADDR (M_AXI_AWADDR), .M_AXI_ALEN (M_AXI_AWLEN), .M_AXI_ASIZE (M_AXI_AWSIZE), .M_AXI_ABURST (M_AXI_AWBURST), .M_AXI_ALOCK (M_AXI_AWLOCK), .M_AXI_ACACHE (M_AXI_AWCACHE), .M_AXI_APROT (M_AXI_AWPROT), .M_AXI_AQOS (M_AXI_AWQOS), .M_AXI_AUSER (M_AXI_AWUSER), .M_AXI_AVALID (M_AXI_AWVALID), .M_AXI_AREADY (M_AXI_AWREADY) ); // Write Data Channel. axi_protocol_converter_v2_1_w_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_WUSER_WIDTH (C_AXI_WUSER_WIDTH), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS) ) write_data_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (wr_cmd_valid), .cmd_id (wr_cmd_id), .cmd_length (wr_cmd_length), .cmd_ready (wr_cmd_ready), // Slave Interface Write Data Ports .S_AXI_WDATA (S_AXI_WDATA), .S_AXI_WSTRB (S_AXI_WSTRB), .S_AXI_WLAST (S_AXI_WLAST), .S_AXI_WUSER (S_AXI_WUSER), .S_AXI_WVALID (S_AXI_WVALID), .S_AXI_WREADY (S_AXI_WREADY), // Master Interface Write Data Ports .M_AXI_WID (M_AXI_WID), .M_AXI_WDATA (M_AXI_WDATA), .M_AXI_WSTRB (M_AXI_WSTRB), .M_AXI_WLAST (M_AXI_WLAST), .M_AXI_WUSER (M_AXI_WUSER), .M_AXI_WVALID (M_AXI_WVALID), .M_AXI_WREADY (M_AXI_WREADY) ); if ( C_SUPPORT_SPLITTING == 1 && C_SUPPORT_BURSTS == 1 ) begin : USE_SPLIT_W // Write Data Response Channel. axi_protocol_converter_v2_1_b_downsizer # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_BUSER_WIDTH (C_AXI_BUSER_WIDTH) ) write_resp_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (wr_cmd_b_valid), .cmd_split (wr_cmd_b_split), .cmd_repeat (wr_cmd_b_repeat), .cmd_ready (wr_cmd_b_ready), // Slave Interface Write Response Ports .S_AXI_BID (S_AXI_BID), .S_AXI_BRESP (S_AXI_BRESP), .S_AXI_BUSER (S_AXI_BUSER), .S_AXI_BVALID (S_AXI_BVALID), .S_AXI_BREADY (S_AXI_BREADY), // Master Interface Write Response Ports .M_AXI_BID (M_AXI_BID), .M_AXI_BRESP (M_AXI_BRESP), .M_AXI_BUSER (M_AXI_BUSER), .M_AXI_BVALID (M_AXI_BVALID), .M_AXI_BREADY (M_AXI_BREADY) ); end else begin : NO_SPLIT_W // MI -> SI Interface Write Response Ports assign S_AXI_BID = M_AXI_BID; assign S_AXI_BRESP = M_AXI_BRESP; assign S_AXI_BUSER = M_AXI_BUSER; assign S_AXI_BVALID = M_AXI_BVALID; assign M_AXI_BREADY = S_AXI_BREADY; end end else begin : NO_WRITE // Slave Interface Write Address Ports assign S_AXI_AWREADY = 1'b0; // Slave Interface Write Data Ports assign S_AXI_WREADY = 1'b0; // Slave Interface Write Response Ports assign S_AXI_BID = {C_AXI_ID_WIDTH{1'b0}}; assign S_AXI_BRESP = 2'b0; assign S_AXI_BUSER = {C_AXI_BUSER_WIDTH{1'b0}}; assign S_AXI_BVALID = 1'b0; // Master Interface Write Address Port assign M_AXI_AWID = {C_AXI_ID_WIDTH{1'b0}}; assign M_AXI_AWADDR = {C_AXI_ADDR_WIDTH{1'b0}}; assign M_AXI_AWLEN = 4'b0; assign M_AXI_AWSIZE = 3'b0; assign M_AXI_AWBURST = 2'b0; assign M_AXI_AWLOCK = 2'b0; assign M_AXI_AWCACHE = 4'b0; assign M_AXI_AWPROT = 3'b0; assign M_AXI_AWQOS = 4'b0; assign M_AXI_AWUSER = {C_AXI_AWUSER_WIDTH{1'b0}}; assign M_AXI_AWVALID = 1'b0; // Master Interface Write Data Ports assign M_AXI_WDATA = {C_AXI_DATA_WIDTH{1'b0}}; assign M_AXI_WSTRB = {C_AXI_DATA_WIDTH/8{1'b0}}; assign M_AXI_WLAST = 1'b0; assign M_AXI_WUSER = {C_AXI_WUSER_WIDTH{1'b0}}; assign M_AXI_WVALID = 1'b0; // Master Interface Write Response Ports assign M_AXI_BREADY = 1'b0; end endgenerate ///////////////////////////////////////////////////////////////////////////// // Handle Read Channels (AR/R) ///////////////////////////////////////////////////////////////////////////// generate if (C_AXI_SUPPORTS_READ == 1) begin : USE_READ // Write Response channel. if ( C_SUPPORT_SPLITTING == 1 && C_SUPPORT_BURSTS == 1 ) begin : USE_SPLIT_R // Read Channel Signals for Commands Queue Interface. wire rd_cmd_valid; wire rd_cmd_split; wire rd_cmd_ready; // Write Address Channel. axi_protocol_converter_v2_1_a_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_ADDR_WIDTH (C_AXI_ADDR_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_AUSER_WIDTH (C_AXI_ARUSER_WIDTH), .C_AXI_CHANNEL (1), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS), .C_SINGLE_THREAD (C_SINGLE_THREAD) ) read_addr_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface (R) .cmd_valid (rd_cmd_valid), .cmd_split (rd_cmd_split), .cmd_id (), .cmd_length (), .cmd_ready (rd_cmd_ready), // Command Interface (B) .cmd_b_valid (), .cmd_b_split (), .cmd_b_repeat (), .cmd_b_ready (1'b0), // Slave Interface Write Address Ports .S_AXI_AID (S_AXI_ARID), .S_AXI_AADDR (S_AXI_ARADDR), .S_AXI_ALEN (S_AXI_ARLEN), .S_AXI_ASIZE (S_AXI_ARSIZE), .S_AXI_ABURST (S_AXI_ARBURST), .S_AXI_ALOCK (S_AXI_ARLOCK), .S_AXI_ACACHE (S_AXI_ARCACHE), .S_AXI_APROT (S_AXI_ARPROT), .S_AXI_AQOS (S_AXI_ARQOS), .S_AXI_AUSER (S_AXI_ARUSER), .S_AXI_AVALID (S_AXI_ARVALID), .S_AXI_AREADY (S_AXI_ARREADY), // Master Interface Write Address Port .M_AXI_AID (M_AXI_ARID), .M_AXI_AADDR (M_AXI_ARADDR), .M_AXI_ALEN (M_AXI_ARLEN), .M_AXI_ASIZE (M_AXI_ARSIZE), .M_AXI_ABURST (M_AXI_ARBURST), .M_AXI_ALOCK (M_AXI_ARLOCK), .M_AXI_ACACHE (M_AXI_ARCACHE), .M_AXI_APROT (M_AXI_ARPROT), .M_AXI_AQOS (M_AXI_ARQOS), .M_AXI_AUSER (M_AXI_ARUSER), .M_AXI_AVALID (M_AXI_ARVALID), .M_AXI_AREADY (M_AXI_ARREADY) ); // Read Data Channel. axi_protocol_converter_v2_1_r_axi3_conv # ( .C_FAMILY (C_FAMILY), .C_AXI_ID_WIDTH (C_AXI_ID_WIDTH), .C_AXI_DATA_WIDTH (C_AXI_DATA_WIDTH), .C_AXI_SUPPORTS_USER_SIGNALS (C_AXI_SUPPORTS_USER_SIGNALS), .C_AXI_RUSER_WIDTH (C_AXI_RUSER_WIDTH), .C_SUPPORT_SPLITTING (C_SUPPORT_SPLITTING), .C_SUPPORT_BURSTS (C_SUPPORT_BURSTS) ) read_data_inst ( // Global Signals .ARESET (~ARESETN), .ACLK (ACLK), // Command Interface .cmd_valid (rd_cmd_valid), .cmd_split (rd_cmd_split), .cmd_ready (rd_cmd_ready), // Slave Interface Read Data Ports .S_AXI_RID (S_AXI_RID), .S_AXI_RDATA (S_AXI_RDATA), .S_AXI_RRESP (S_AXI_RRESP), .S_AXI_RLAST (S_AXI_RLAST), .S_AXI_RUSER (S_AXI_RUSER), .S_AXI_RVALID (S_AXI_RVALID), .S_AXI_RREADY (S_AXI_RREADY), // Master Interface Read Data Ports .M_AXI_RID (M_AXI_RID), .M_AXI_RDATA (M_AXI_RDATA), .M_AXI_RRESP (M_AXI_RRESP), .M_AXI_RLAST (M_AXI_RLAST), .M_AXI_RUSER (M_AXI_RUSER), .M_AXI_RVALID (M_AXI_RVALID), .M_AXI_RREADY (M_AXI_RREADY) ); end else begin : NO_SPLIT_R // SI -> MI Interface Write Address Port assign M_AXI_ARID = S_AXI_ARID; assign M_AXI_ARADDR = S_AXI_ARADDR; assign M_AXI_ARLEN = S_AXI_ARLEN; assign M_AXI_ARSIZE = S_AXI_ARSIZE; assign M_AXI_ARBURST = S_AXI_ARBURST; assign M_AXI_ARLOCK = S_AXI_ARLOCK; assign M_AXI_ARCACHE = S_AXI_ARCACHE; assign M_AXI_ARPROT = S_AXI_ARPROT; assign M_AXI_ARQOS = S_AXI_ARQOS; assign M_AXI_ARUSER = S_AXI_ARUSER; assign M_AXI_ARVALID = S_AXI_ARVALID; assign S_AXI_ARREADY = M_AXI_ARREADY; // MI -> SI Interface Read Data Ports assign S_AXI_RID = M_AXI_RID; assign S_AXI_RDATA = M_AXI_RDATA; assign S_AXI_RRESP = M_AXI_RRESP; assign S_AXI_RLAST = M_AXI_RLAST; assign S_AXI_RUSER = M_AXI_RUSER; assign S_AXI_RVALID = M_AXI_RVALID; assign M_AXI_RREADY = S_AXI_RREADY; end end else begin : NO_READ // Slave Interface Read Address Ports assign S_AXI_ARREADY = 1'b0; // Slave Interface Read Data Ports assign S_AXI_RID = {C_AXI_ID_WIDTH{1'b0}}; assign S_AXI_RDATA = {C_AXI_DATA_WIDTH{1'b0}}; assign S_AXI_RRESP = 2'b0; assign S_AXI_RLAST = 1'b0; assign S_AXI_RUSER = {C_AXI_RUSER_WIDTH{1'b0}}; assign S_AXI_RVALID = 1'b0; // Master Interface Read Address Port assign M_AXI_ARID = {C_AXI_ID_WIDTH{1'b0}}; assign M_AXI_ARADDR = {C_AXI_ADDR_WIDTH{1'b0}}; assign M_AXI_ARLEN = 4'b0; assign M_AXI_ARSIZE = 3'b0; assign M_AXI_ARBURST = 2'b0; assign M_AXI_ARLOCK = 2'b0; assign M_AXI_ARCACHE = 4'b0; assign M_AXI_ARPROT = 3'b0; assign M_AXI_ARQOS = 4'b0; assign M_AXI_ARUSER = {C_AXI_ARUSER_WIDTH{1'b0}}; assign M_AXI_ARVALID = 1'b0; // Master Interface Read Data Ports assign M_AXI_RREADY = 1'b0; end endgenerate endmodule
module altera_reset_synchronizer #( parameter ASYNC_RESET = 1, parameter DEPTH = 2 ) ( input reset_in /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */, input clk, output reset_out ); // ----------------------------------------------- // Synchronizer register chain. We cannot reuse the // standard synchronizer in this implementation // because our timing constraints are different. // // Instead of cutting the timing path to the d-input // on the first flop we need to cut the aclr input. // // We omit the "preserve" attribute on the final // output register, so that the synthesis tool can // duplicate it where needed. // ----------------------------------------------- (*preserve*) reg [DEPTH-1:0] altera_reset_synchronizer_int_chain; reg altera_reset_synchronizer_int_chain_out; generate if (ASYNC_RESET) begin // ----------------------------------------------- // Assert asynchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk or posedge reset_in) begin if (reset_in) begin altera_reset_synchronizer_int_chain <= {DEPTH{1'b1}}; altera_reset_synchronizer_int_chain_out <= 1'b1; end else begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= 0; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end end assign reset_out = altera_reset_synchronizer_int_chain_out; end else begin // ----------------------------------------------- // Assert synchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk) begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= reset_in; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end assign reset_out = altera_reset_synchronizer_int_chain_out; end endgenerate endmodule
module altera_reset_synchronizer #( parameter ASYNC_RESET = 1, parameter DEPTH = 2 ) ( input reset_in /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */, input clk, output reset_out ); // ----------------------------------------------- // Synchronizer register chain. We cannot reuse the // standard synchronizer in this implementation // because our timing constraints are different. // // Instead of cutting the timing path to the d-input // on the first flop we need to cut the aclr input. // // We omit the "preserve" attribute on the final // output register, so that the synthesis tool can // duplicate it where needed. // ----------------------------------------------- (*preserve*) reg [DEPTH-1:0] altera_reset_synchronizer_int_chain; reg altera_reset_synchronizer_int_chain_out; generate if (ASYNC_RESET) begin // ----------------------------------------------- // Assert asynchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk or posedge reset_in) begin if (reset_in) begin altera_reset_synchronizer_int_chain <= {DEPTH{1'b1}}; altera_reset_synchronizer_int_chain_out <= 1'b1; end else begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= 0; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end end assign reset_out = altera_reset_synchronizer_int_chain_out; end else begin // ----------------------------------------------- // Assert synchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk) begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= reset_in; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end assign reset_out = altera_reset_synchronizer_int_chain_out; end endgenerate endmodule
module altera_reset_synchronizer #( parameter ASYNC_RESET = 1, parameter DEPTH = 2 ) ( input reset_in /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */, input clk, output reset_out ); // ----------------------------------------------- // Synchronizer register chain. We cannot reuse the // standard synchronizer in this implementation // because our timing constraints are different. // // Instead of cutting the timing path to the d-input // on the first flop we need to cut the aclr input. // // We omit the "preserve" attribute on the final // output register, so that the synthesis tool can // duplicate it where needed. // ----------------------------------------------- (*preserve*) reg [DEPTH-1:0] altera_reset_synchronizer_int_chain; reg altera_reset_synchronizer_int_chain_out; generate if (ASYNC_RESET) begin // ----------------------------------------------- // Assert asynchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk or posedge reset_in) begin if (reset_in) begin altera_reset_synchronizer_int_chain <= {DEPTH{1'b1}}; altera_reset_synchronizer_int_chain_out <= 1'b1; end else begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= 0; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end end assign reset_out = altera_reset_synchronizer_int_chain_out; end else begin // ----------------------------------------------- // Assert synchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk) begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= reset_in; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end assign reset_out = altera_reset_synchronizer_int_chain_out; end endgenerate endmodule
module altera_reset_synchronizer #( parameter ASYNC_RESET = 1, parameter DEPTH = 2 ) ( input reset_in /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */, input clk, output reset_out ); // ----------------------------------------------- // Synchronizer register chain. We cannot reuse the // standard synchronizer in this implementation // because our timing constraints are different. // // Instead of cutting the timing path to the d-input // on the first flop we need to cut the aclr input. // // We omit the "preserve" attribute on the final // output register, so that the synthesis tool can // duplicate it where needed. // ----------------------------------------------- (*preserve*) reg [DEPTH-1:0] altera_reset_synchronizer_int_chain; reg altera_reset_synchronizer_int_chain_out; generate if (ASYNC_RESET) begin // ----------------------------------------------- // Assert asynchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk or posedge reset_in) begin if (reset_in) begin altera_reset_synchronizer_int_chain <= {DEPTH{1'b1}}; altera_reset_synchronizer_int_chain_out <= 1'b1; end else begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= 0; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end end assign reset_out = altera_reset_synchronizer_int_chain_out; end else begin // ----------------------------------------------- // Assert synchronously, deassert synchronously. // ----------------------------------------------- always @(posedge clk) begin altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1]; altera_reset_synchronizer_int_chain[DEPTH-1] <= reset_in; altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0]; end assign reset_out = altera_reset_synchronizer_int_chain_out; end endgenerate endmodule
module altera_avalon_st_pipeline_base ( clk, reset, in_ready, in_valid, in_data, out_ready, out_valid, out_data ); parameter SYMBOLS_PER_BEAT = 1; parameter BITS_PER_SYMBOL = 8; parameter PIPELINE_READY = 1; localparam DATA_WIDTH = SYMBOLS_PER_BEAT * BITS_PER_SYMBOL; input clk; input reset; output in_ready; input in_valid; input [DATA_WIDTH-1:0] in_data; input out_ready; output out_valid; output [DATA_WIDTH-1:0] out_data; reg full0; reg full1; reg [DATA_WIDTH-1:0] data0; reg [DATA_WIDTH-1:0] data1; assign out_valid = full1; assign out_data = data1; generate if (PIPELINE_READY == 1) begin : REGISTERED_READY_PLINE assign in_ready = !full0; always @(posedge clk, posedge reset) begin if (reset) begin data0 <= {DATA_WIDTH{1'b0}}; data1 <= {DATA_WIDTH{1'b0}}; end else begin // ---------------------------- // always load the second slot if we can // ---------------------------- if (~full0) data0 <= in_data; // ---------------------------- // first slot is loaded either from the second, // or with new data // ---------------------------- if (~full1 || (out_ready && out_valid)) begin if (full0) data1 <= data0; else data1 <= in_data; end end end always @(posedge clk or posedge reset) begin if (reset) begin full0 <= 1'b0; full1 <= 1'b0; end else begin // no data in pipeline if (~full0 & ~full1) begin if (in_valid) begin full1 <= 1'b1; end end // ~f1 & ~f0 // one datum in pipeline if (full1 & ~full0) begin if (in_valid & ~out_ready) begin full0 <= 1'b1; end // back to empty if (~in_valid & out_ready) begin full1 <= 1'b0; end end // f1 & ~f0 // two data in pipeline if (full1 & full0) begin // go back to one datum state if (out_ready) begin full0 <= 1'b0; end end // end go back to one datum stage end end end else begin : UNREGISTERED_READY_PLINE // in_ready will be a pass through of the out_ready signal as it is not registered assign in_ready = (~full1) | out_ready; always @(posedge clk or posedge reset) begin if (reset) begin data1 <= 'b0; full1 <= 1'b0; end else begin if (in_ready) begin data1 <= in_data; full1 <= in_valid; end end end end endgenerate endmodule
module altera_avalon_st_pipeline_base ( clk, reset, in_ready, in_valid, in_data, out_ready, out_valid, out_data ); parameter SYMBOLS_PER_BEAT = 1; parameter BITS_PER_SYMBOL = 8; parameter PIPELINE_READY = 1; localparam DATA_WIDTH = SYMBOLS_PER_BEAT * BITS_PER_SYMBOL; input clk; input reset; output in_ready; input in_valid; input [DATA_WIDTH-1:0] in_data; input out_ready; output out_valid; output [DATA_WIDTH-1:0] out_data; reg full0; reg full1; reg [DATA_WIDTH-1:0] data0; reg [DATA_WIDTH-1:0] data1; assign out_valid = full1; assign out_data = data1; generate if (PIPELINE_READY == 1) begin : REGISTERED_READY_PLINE assign in_ready = !full0; always @(posedge clk, posedge reset) begin if (reset) begin data0 <= {DATA_WIDTH{1'b0}}; data1 <= {DATA_WIDTH{1'b0}}; end else begin // ---------------------------- // always load the second slot if we can // ---------------------------- if (~full0) data0 <= in_data; // ---------------------------- // first slot is loaded either from the second, // or with new data // ---------------------------- if (~full1 || (out_ready && out_valid)) begin if (full0) data1 <= data0; else data1 <= in_data; end end end always @(posedge clk or posedge reset) begin if (reset) begin full0 <= 1'b0; full1 <= 1'b0; end else begin // no data in pipeline if (~full0 & ~full1) begin if (in_valid) begin full1 <= 1'b1; end end // ~f1 & ~f0 // one datum in pipeline if (full1 & ~full0) begin if (in_valid & ~out_ready) begin full0 <= 1'b1; end // back to empty if (~in_valid & out_ready) begin full1 <= 1'b0; end end // f1 & ~f0 // two data in pipeline if (full1 & full0) begin // go back to one datum state if (out_ready) begin full0 <= 1'b0; end end // end go back to one datum stage end end end else begin : UNREGISTERED_READY_PLINE // in_ready will be a pass through of the out_ready signal as it is not registered assign in_ready = (~full1) | out_ready; always @(posedge clk or posedge reset) begin if (reset) begin data1 <= 'b0; full1 <= 1'b0; end else begin if (in_ready) begin data1 <= in_data; full1 <= in_valid; end end end end endgenerate endmodule
module altera_avalon_st_pipeline_base ( clk, reset, in_ready, in_valid, in_data, out_ready, out_valid, out_data ); parameter SYMBOLS_PER_BEAT = 1; parameter BITS_PER_SYMBOL = 8; parameter PIPELINE_READY = 1; localparam DATA_WIDTH = SYMBOLS_PER_BEAT * BITS_PER_SYMBOL; input clk; input reset; output in_ready; input in_valid; input [DATA_WIDTH-1:0] in_data; input out_ready; output out_valid; output [DATA_WIDTH-1:0] out_data; reg full0; reg full1; reg [DATA_WIDTH-1:0] data0; reg [DATA_WIDTH-1:0] data1; assign out_valid = full1; assign out_data = data1; generate if (PIPELINE_READY == 1) begin : REGISTERED_READY_PLINE assign in_ready = !full0; always @(posedge clk, posedge reset) begin if (reset) begin data0 <= {DATA_WIDTH{1'b0}}; data1 <= {DATA_WIDTH{1'b0}}; end else begin // ---------------------------- // always load the second slot if we can // ---------------------------- if (~full0) data0 <= in_data; // ---------------------------- // first slot is loaded either from the second, // or with new data // ---------------------------- if (~full1 || (out_ready && out_valid)) begin if (full0) data1 <= data0; else data1 <= in_data; end end end always @(posedge clk or posedge reset) begin if (reset) begin full0 <= 1'b0; full1 <= 1'b0; end else begin // no data in pipeline if (~full0 & ~full1) begin if (in_valid) begin full1 <= 1'b1; end end // ~f1 & ~f0 // one datum in pipeline if (full1 & ~full0) begin if (in_valid & ~out_ready) begin full0 <= 1'b1; end // back to empty if (~in_valid & out_ready) begin full1 <= 1'b0; end end // f1 & ~f0 // two data in pipeline if (full1 & full0) begin // go back to one datum state if (out_ready) begin full0 <= 1'b0; end end // end go back to one datum stage end end end else begin : UNREGISTERED_READY_PLINE // in_ready will be a pass through of the out_ready signal as it is not registered assign in_ready = (~full1) | out_ready; always @(posedge clk or posedge reset) begin if (reset) begin data1 <= 'b0; full1 <= 1'b0; end else begin if (in_ready) begin data1 <= in_data; full1 <= in_valid; end end end end endgenerate endmodule
module processing_system7_v5_5_aw_atc # ( parameter C_FAMILY = "rtl", // FPGA Family. Current version: virtex6, spartan6 or later. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of checker. // Range: >= 1. parameter integer C_AXI_ADDR_WIDTH = 32, // Width of all ADDR signals on SI and MI side of checker. // Range: 32. parameter integer C_AXI_AWUSER_WIDTH = 1, // Width of AWUSER signals. // Range: >= 1. parameter integer C_FIFO_DEPTH_LOG = 4 ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface output reg cmd_w_valid, output wire cmd_w_check, output wire [C_AXI_ID_WIDTH-1:0] cmd_w_id, input wire cmd_w_ready, input wire [C_FIFO_DEPTH_LOG-1:0] cmd_b_addr, input wire cmd_b_ready, // Slave Interface Write Address Port input wire [C_AXI_ID_WIDTH-1:0] S_AXI_AWID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_AWADDR, input wire [4-1:0] S_AXI_AWLEN, input wire [3-1:0] S_AXI_AWSIZE, input wire [2-1:0] S_AXI_AWBURST, input wire [2-1:0] S_AXI_AWLOCK, input wire [4-1:0] S_AXI_AWCACHE, input wire [3-1:0] S_AXI_AWPROT, input wire [C_AXI_AWUSER_WIDTH-1:0] S_AXI_AWUSER, input wire S_AXI_AWVALID, output wire S_AXI_AWREADY, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_AWID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_AWADDR, output wire [4-1:0] M_AXI_AWLEN, output wire [3-1:0] M_AXI_AWSIZE, output wire [2-1:0] M_AXI_AWBURST, output wire [2-1:0] M_AXI_AWLOCK, output wire [4-1:0] M_AXI_AWCACHE, output wire [3-1:0] M_AXI_AWPROT, output wire [C_AXI_AWUSER_WIDTH-1:0] M_AXI_AWUSER, output wire M_AXI_AWVALID, input wire M_AXI_AWREADY ); ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for burst types. localparam [2-1:0] C_FIX_BURST = 2'b00; localparam [2-1:0] C_INCR_BURST = 2'b01; localparam [2-1:0] C_WRAP_BURST = 2'b10; // Constants for size. localparam [3-1:0] C_OPTIMIZED_SIZE = 3'b011; // Constants for length. localparam [4-1:0] C_OPTIMIZED_LEN = 4'b0011; // Constants for cacheline address. localparam [4-1:0] C_NO_ADDR_OFFSET = 5'b0; // Command FIFO settings localparam C_FIFO_WIDTH = C_AXI_ID_WIDTH + 1; localparam C_FIFO_DEPTH = 2 ** C_FIFO_DEPTH_LOG; ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// integer index; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Transaction properties. wire access_is_incr; wire access_is_wrap; wire access_is_coherent; wire access_optimized_size; wire incr_addr_boundary; wire incr_is_optimized; wire wrap_is_optimized; wire access_is_optimized; // Command FIFO. wire cmd_w_push; reg cmd_full; reg [C_FIFO_DEPTH_LOG-1:0] addr_ptr; wire [C_FIFO_DEPTH_LOG-1:0] all_addr_ptr; reg [C_FIFO_WIDTH-1:0] data_srl[C_FIFO_DEPTH-1:0]; ///////////////////////////////////////////////////////////////////////////// // Transaction Decode: // // Detect if transaction is of correct typ, size and length to qualify as // an optimized transaction that has to be checked for errors. // ///////////////////////////////////////////////////////////////////////////// // Transaction burst type. assign access_is_incr = ( S_AXI_AWBURST == C_INCR_BURST ); assign access_is_wrap = ( S_AXI_AWBURST == C_WRAP_BURST ); // Transaction has to be Coherent. assign access_is_coherent = ( S_AXI_AWUSER[0] == 1'b1 ) & ( S_AXI_AWCACHE[1] == 1'b1 ); // Transaction cacheline boundary address. assign incr_addr_boundary = ( S_AXI_AWADDR[4:0] == C_NO_ADDR_OFFSET ); // Transaction length & size. assign access_optimized_size = ( S_AXI_AWSIZE == C_OPTIMIZED_SIZE ) & ( S_AXI_AWLEN == C_OPTIMIZED_LEN ); // Transaction is optimized. assign incr_is_optimized = access_is_incr & access_is_coherent & access_optimized_size & incr_addr_boundary; assign wrap_is_optimized = access_is_wrap & access_is_coherent & access_optimized_size; assign access_is_optimized = ( incr_is_optimized | wrap_is_optimized ); ///////////////////////////////////////////////////////////////////////////// // Command FIFO: // // Since supported write interleaving is only 1, it is safe to use only a // simple SRL based FIFO as a command queue. // ///////////////////////////////////////////////////////////////////////////// // Determine when transaction infromation is pushed to the FIFO. assign cmd_w_push = S_AXI_AWVALID & M_AXI_AWREADY & ~cmd_full; // SRL FIFO Pointer. always @ (posedge ACLK) begin if (ARESET) begin addr_ptr <= {C_FIFO_DEPTH_LOG{1'b1}}; end else begin if ( cmd_w_push & ~cmd_w_ready ) begin addr_ptr <= addr_ptr + 1; end else if ( ~cmd_w_push & cmd_w_ready ) begin addr_ptr <= addr_ptr - 1; end end end // Total number of buffered commands. assign all_addr_ptr = addr_ptr + cmd_b_addr + 2; // FIFO Flags. always @ (posedge ACLK) begin if (ARESET) begin cmd_full <= 1'b0; cmd_w_valid <= 1'b0; end else begin if ( cmd_w_push & ~cmd_w_ready ) begin cmd_w_valid <= 1'b1; end else if ( ~cmd_w_push & cmd_w_ready ) begin cmd_w_valid <= ( addr_ptr != 0 ); end if ( cmd_w_push & ~cmd_b_ready ) begin // Going to full. cmd_full <= ( all_addr_ptr == C_FIFO_DEPTH-3 ); end else if ( ~cmd_w_push & cmd_b_ready ) begin // Pop in middle of queue doesn't affect full status. cmd_full <= ( all_addr_ptr == C_FIFO_DEPTH-2 ); end end end // Infere SRL for storage. always @ (posedge ACLK) begin if ( cmd_w_push ) begin for (index = 0; index < C_FIFO_DEPTH-1 ; index = index + 1) begin data_srl[index+1] <= data_srl[index]; end data_srl[0] <= {access_is_optimized, S_AXI_AWID}; end end // Get current transaction info. assign {cmd_w_check, cmd_w_id} = data_srl[addr_ptr]; ///////////////////////////////////////////////////////////////////////////// // Transaction Throttling: // // Stall commands if FIFO is full. // ///////////////////////////////////////////////////////////////////////////// // Propagate masked valid. assign M_AXI_AWVALID = S_AXI_AWVALID & ~cmd_full; // Return ready with push back. assign S_AXI_AWREADY = M_AXI_AWREADY & ~cmd_full; ///////////////////////////////////////////////////////////////////////////// // Address Write propagation: // // All information is simply forwarded on from the SI- to MI-Side untouched. // ///////////////////////////////////////////////////////////////////////////// // 1:1 mapping. assign M_AXI_AWID = S_AXI_AWID; assign M_AXI_AWADDR = S_AXI_AWADDR; assign M_AXI_AWLEN = S_AXI_AWLEN; assign M_AXI_AWSIZE = S_AXI_AWSIZE; assign M_AXI_AWBURST = S_AXI_AWBURST; assign M_AXI_AWLOCK = S_AXI_AWLOCK; assign M_AXI_AWCACHE = S_AXI_AWCACHE; assign M_AXI_AWPROT = S_AXI_AWPROT; assign M_AXI_AWUSER = S_AXI_AWUSER; endmodule
module processing_system7_v5_5_aw_atc # ( parameter C_FAMILY = "rtl", // FPGA Family. Current version: virtex6, spartan6 or later. parameter integer C_AXI_ID_WIDTH = 4, // Width of all ID signals on SI and MI side of checker. // Range: >= 1. parameter integer C_AXI_ADDR_WIDTH = 32, // Width of all ADDR signals on SI and MI side of checker. // Range: 32. parameter integer C_AXI_AWUSER_WIDTH = 1, // Width of AWUSER signals. // Range: >= 1. parameter integer C_FIFO_DEPTH_LOG = 4 ) ( // Global Signals input wire ARESET, input wire ACLK, // Command Interface output reg cmd_w_valid, output wire cmd_w_check, output wire [C_AXI_ID_WIDTH-1:0] cmd_w_id, input wire cmd_w_ready, input wire [C_FIFO_DEPTH_LOG-1:0] cmd_b_addr, input wire cmd_b_ready, // Slave Interface Write Address Port input wire [C_AXI_ID_WIDTH-1:0] S_AXI_AWID, input wire [C_AXI_ADDR_WIDTH-1:0] S_AXI_AWADDR, input wire [4-1:0] S_AXI_AWLEN, input wire [3-1:0] S_AXI_AWSIZE, input wire [2-1:0] S_AXI_AWBURST, input wire [2-1:0] S_AXI_AWLOCK, input wire [4-1:0] S_AXI_AWCACHE, input wire [3-1:0] S_AXI_AWPROT, input wire [C_AXI_AWUSER_WIDTH-1:0] S_AXI_AWUSER, input wire S_AXI_AWVALID, output wire S_AXI_AWREADY, // Master Interface Write Address Port output wire [C_AXI_ID_WIDTH-1:0] M_AXI_AWID, output wire [C_AXI_ADDR_WIDTH-1:0] M_AXI_AWADDR, output wire [4-1:0] M_AXI_AWLEN, output wire [3-1:0] M_AXI_AWSIZE, output wire [2-1:0] M_AXI_AWBURST, output wire [2-1:0] M_AXI_AWLOCK, output wire [4-1:0] M_AXI_AWCACHE, output wire [3-1:0] M_AXI_AWPROT, output wire [C_AXI_AWUSER_WIDTH-1:0] M_AXI_AWUSER, output wire M_AXI_AWVALID, input wire M_AXI_AWREADY ); ///////////////////////////////////////////////////////////////////////////// // Local params ///////////////////////////////////////////////////////////////////////////// // Constants for burst types. localparam [2-1:0] C_FIX_BURST = 2'b00; localparam [2-1:0] C_INCR_BURST = 2'b01; localparam [2-1:0] C_WRAP_BURST = 2'b10; // Constants for size. localparam [3-1:0] C_OPTIMIZED_SIZE = 3'b011; // Constants for length. localparam [4-1:0] C_OPTIMIZED_LEN = 4'b0011; // Constants for cacheline address. localparam [4-1:0] C_NO_ADDR_OFFSET = 5'b0; // Command FIFO settings localparam C_FIFO_WIDTH = C_AXI_ID_WIDTH + 1; localparam C_FIFO_DEPTH = 2 ** C_FIFO_DEPTH_LOG; ///////////////////////////////////////////////////////////////////////////// // Variables for generating parameter controlled instances. ///////////////////////////////////////////////////////////////////////////// integer index; ///////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Internal signals ///////////////////////////////////////////////////////////////////////////// // Transaction properties. wire access_is_incr; wire access_is_wrap; wire access_is_coherent; wire access_optimized_size; wire incr_addr_boundary; wire incr_is_optimized; wire wrap_is_optimized; wire access_is_optimized; // Command FIFO. wire cmd_w_push; reg cmd_full; reg [C_FIFO_DEPTH_LOG-1:0] addr_ptr; wire [C_FIFO_DEPTH_LOG-1:0] all_addr_ptr; reg [C_FIFO_WIDTH-1:0] data_srl[C_FIFO_DEPTH-1:0]; ///////////////////////////////////////////////////////////////////////////// // Transaction Decode: // // Detect if transaction is of correct typ, size and length to qualify as // an optimized transaction that has to be checked for errors. // ///////////////////////////////////////////////////////////////////////////// // Transaction burst type. assign access_is_incr = ( S_AXI_AWBURST == C_INCR_BURST ); assign access_is_wrap = ( S_AXI_AWBURST == C_WRAP_BURST ); // Transaction has to be Coherent. assign access_is_coherent = ( S_AXI_AWUSER[0] == 1'b1 ) & ( S_AXI_AWCACHE[1] == 1'b1 ); // Transaction cacheline boundary address. assign incr_addr_boundary = ( S_AXI_AWADDR[4:0] == C_NO_ADDR_OFFSET ); // Transaction length & size. assign access_optimized_size = ( S_AXI_AWSIZE == C_OPTIMIZED_SIZE ) & ( S_AXI_AWLEN == C_OPTIMIZED_LEN ); // Transaction is optimized. assign incr_is_optimized = access_is_incr & access_is_coherent & access_optimized_size & incr_addr_boundary; assign wrap_is_optimized = access_is_wrap & access_is_coherent & access_optimized_size; assign access_is_optimized = ( incr_is_optimized | wrap_is_optimized ); ///////////////////////////////////////////////////////////////////////////// // Command FIFO: // // Since supported write interleaving is only 1, it is safe to use only a // simple SRL based FIFO as a command queue. // ///////////////////////////////////////////////////////////////////////////// // Determine when transaction infromation is pushed to the FIFO. assign cmd_w_push = S_AXI_AWVALID & M_AXI_AWREADY & ~cmd_full; // SRL FIFO Pointer. always @ (posedge ACLK) begin if (ARESET) begin addr_ptr <= {C_FIFO_DEPTH_LOG{1'b1}}; end else begin if ( cmd_w_push & ~cmd_w_ready ) begin addr_ptr <= addr_ptr + 1; end else if ( ~cmd_w_push & cmd_w_ready ) begin addr_ptr <= addr_ptr - 1; end end end // Total number of buffered commands. assign all_addr_ptr = addr_ptr + cmd_b_addr + 2; // FIFO Flags. always @ (posedge ACLK) begin if (ARESET) begin cmd_full <= 1'b0; cmd_w_valid <= 1'b0; end else begin if ( cmd_w_push & ~cmd_w_ready ) begin cmd_w_valid <= 1'b1; end else if ( ~cmd_w_push & cmd_w_ready ) begin cmd_w_valid <= ( addr_ptr != 0 ); end if ( cmd_w_push & ~cmd_b_ready ) begin // Going to full. cmd_full <= ( all_addr_ptr == C_FIFO_DEPTH-3 ); end else if ( ~cmd_w_push & cmd_b_ready ) begin // Pop in middle of queue doesn't affect full status. cmd_full <= ( all_addr_ptr == C_FIFO_DEPTH-2 ); end end end // Infere SRL for storage. always @ (posedge ACLK) begin if ( cmd_w_push ) begin for (index = 0; index < C_FIFO_DEPTH-1 ; index = index + 1) begin data_srl[index+1] <= data_srl[index]; end data_srl[0] <= {access_is_optimized, S_AXI_AWID}; end end // Get current transaction info. assign {cmd_w_check, cmd_w_id} = data_srl[addr_ptr]; ///////////////////////////////////////////////////////////////////////////// // Transaction Throttling: // // Stall commands if FIFO is full. // ///////////////////////////////////////////////////////////////////////////// // Propagate masked valid. assign M_AXI_AWVALID = S_AXI_AWVALID & ~cmd_full; // Return ready with push back. assign S_AXI_AWREADY = M_AXI_AWREADY & ~cmd_full; ///////////////////////////////////////////////////////////////////////////// // Address Write propagation: // // All information is simply forwarded on from the SI- to MI-Side untouched. // ///////////////////////////////////////////////////////////////////////////// // 1:1 mapping. assign M_AXI_AWID = S_AXI_AWID; assign M_AXI_AWADDR = S_AXI_AWADDR; assign M_AXI_AWLEN = S_AXI_AWLEN; assign M_AXI_AWSIZE = S_AXI_AWSIZE; assign M_AXI_AWBURST = S_AXI_AWBURST; assign M_AXI_AWLOCK = S_AXI_AWLOCK; assign M_AXI_AWCACHE = S_AXI_AWCACHE; assign M_AXI_AWPROT = S_AXI_AWPROT; assign M_AXI_AWUSER = S_AXI_AWUSER; endmodule