Files
gps/hardware/generated/genesys2-soc-verilog/SBToTL.sv
T
2026-08-06 22:14:52 +03:00

172 lines
6.7 KiB
Systemverilog

// Generated by CIRCT firtool-1.151.0
// Users can define 'PRINTF_COND' to add an extra gate to prints.
`ifndef PRINTF_COND_
`ifdef PRINTF_COND
`define PRINTF_COND_ (`PRINTF_COND)
`else // PRINTF_COND
`define PRINTF_COND_ 1
`endif // PRINTF_COND
`endif // not def PRINTF_COND_
module SBToTL(
input clock,
reset,
auto_out_a_ready,
output auto_out_a_valid,
output [2:0] auto_out_a_bits_opcode,
output [3:0] auto_out_a_bits_size,
output [31:0] auto_out_a_bits_address,
output [7:0] auto_out_a_bits_data,
output auto_out_d_ready,
input auto_out_d_valid,
input [2:0] auto_out_d_bits_opcode,
input [1:0] auto_out_d_bits_param,
input [3:0] auto_out_d_bits_size,
input auto_out_d_bits_sink,
auto_out_d_bits_denied,
input [7:0] auto_out_d_bits_data,
input auto_out_d_bits_corrupt,
io_rdEn,
io_wrEn,
input [127:0] io_addrIn,
io_dataIn,
input [2:0] io_sizeIn,
output io_rdLegal,
io_wrLegal,
io_rdDone,
io_wrDone,
io_respError,
output [7:0] io_dataOut,
output io_rdLoad_0,
io_rdLoad_1,
io_rdLoad_2,
io_rdLoad_3,
io_rdLoad_4,
io_rdLoad_5,
io_rdLoad_6,
io_rdLoad_7,
output [2:0] io_sbStateOut
);
wire _d_q_io_deq_valid;
wire _d_q_io_deq_bits_denied;
wire _d_q_io_deq_bits_corrupt;
reg [2:0] sbState;
wire _rdTxValid_T = sbState == 3'h3;
wire _io_wrDone_T = sbState == 3'h4;
wire d_q_io_deq_ready = _rdTxValid_T | _io_wrDone_T;
reg [3:0] counter;
wire [7:0][7:0] _GEN =
{{io_dataIn[63:56]},
{io_dataIn[55:48]},
{io_dataIn[47:40]},
{io_dataIn[39:32]},
{io_dataIn[31:24]},
{io_dataIn[23:16]},
{io_dataIn[15:8]},
{io_dataIn[7:0]}};
wire _GEN_0 = |(io_addrIn[127:12]);
wire _GEN_1 = |{io_addrIn[127:14], ~(io_addrIn[13:12])};
wire _GEN_2 = |{io_addrIn[127:26], io_addrIn[25:16] ^ 10'h200};
wire _GEN_3 = |{io_addrIn[127:28], ~(io_addrIn[27:26])};
wire _GEN_4 = |{io_addrIn[127:29], io_addrIn[28:12] ^ 17'h10013};
wire _GEN_5 = |{io_addrIn[127:29], io_addrIn[28:13] ^ 16'h800A};
wire _GEN_6 = |{io_addrIn[127:29], io_addrIn[28:15] ^ 14'h2004};
wire _GEN_7 = |{io_addrIn[127:29], io_addrIn[28:13] ^ 16'h8014};
wire _GEN_8 = |{io_addrIn[127:29], io_addrIn[28:12] ^ 17'h1002A};
wire _GEN_9 = |{io_addrIn[127:32], io_addrIn[31:20] ^ 12'h800};
wire io_rdLegal_0 =
~_GEN_0 | ~_GEN_1 | {io_addrIn[127:17], ~(io_addrIn[16])} == 112'h0 | ~_GEN_2
| ~_GEN_3 | ~_GEN_4 | ~_GEN_5 | ~_GEN_6 | ~_GEN_7 | ~_GEN_8 | ~_GEN_9;
wire io_wrLegal_0 =
~_GEN_0 | ~_GEN_1 | ~_GEN_2 | ~_GEN_3 | ~_GEN_4 | ~_GEN_5 | ~_GEN_6 | ~_GEN_7
| ~_GEN_8 | ~_GEN_9;
wire _nodeOut_a_valid_T = sbState == 3'h1;
wire _nodeOut_a_valid_T_1 = sbState == 3'h2;
wire rdTxValid = _rdTxValid_T & _d_q_io_deq_valid & d_q_io_deq_ready;
wire txLast = {4'h0, counter} == (8'h1 << io_sizeIn) - 8'h1;
wire _GEN_10 = sbState == 3'h0;
wire nodeOut_a_valid = _nodeOut_a_valid_T | _nodeOut_a_valid_T_1;
wire _GEN_11 =
_GEN_10 | _nodeOut_a_valid_T | _nodeOut_a_valid_T_1 | _rdTxValid_T | _io_wrDone_T;
`ifndef SYNTHESIS
always @(posedge clock) begin
if ((`PRINTF_COND_) & ~reset & ~_GEN_11)
$fwrite(32'h80000002,
"Assertion failed: SBA state machine in undefined state\n at SBA.scala:373 assert (sbState === Idle.id.U ||\n");
end // always @(posedge)
`endif // not def SYNTHESIS
always @(posedge clock) begin
if (reset) begin
sbState <= 3'h0;
counter <= 4'h0;
end
else begin
automatic logic wrTxValid;
automatic logic _counter_T_2;
wrTxValid = _nodeOut_a_valid_T_1 & nodeOut_a_valid & auto_out_a_ready;
_counter_T_2 = wrTxValid | rdTxValid;
if (_GEN_10) begin
if (io_rdEn & io_rdLegal_0)
sbState <= 3'h1;
else if (io_wrEn & io_wrLegal_0)
sbState <= 3'h2;
end
else if (_nodeOut_a_valid_T) begin
if (nodeOut_a_valid & auto_out_a_ready)
sbState <= 3'h3;
end
else if (_nodeOut_a_valid_T_1) begin
if (wrTxValid & txLast)
sbState <= 3'h4;
end
else if (_rdTxValid_T
? rdTxValid & txLast
: _io_wrDone_T & _d_q_io_deq_valid & d_q_io_deq_ready)
sbState <= 3'h0;
if (_counter_T_2 & txLast)
counter <= 4'h0;
else if (_counter_T_2)
counter <= counter + 4'h1;
end
end // always @(posedge)
Queue2_TLBundleD_a32d8s1k1z4u d_q (
.clock (clock),
.reset (reset),
.io_enq_ready (auto_out_d_ready),
.io_enq_valid (auto_out_d_valid),
.io_enq_bits_opcode (auto_out_d_bits_opcode),
.io_enq_bits_param (auto_out_d_bits_param),
.io_enq_bits_size (auto_out_d_bits_size),
.io_enq_bits_sink (auto_out_d_bits_sink),
.io_enq_bits_denied (auto_out_d_bits_denied),
.io_enq_bits_data (auto_out_d_bits_data),
.io_enq_bits_corrupt (auto_out_d_bits_corrupt),
.io_deq_ready (d_q_io_deq_ready),
.io_deq_valid (_d_q_io_deq_valid),
.io_deq_bits_denied (_d_q_io_deq_bits_denied),
.io_deq_bits_data (io_dataOut),
.io_deq_bits_corrupt (_d_q_io_deq_bits_corrupt)
);
assign auto_out_a_valid = nodeOut_a_valid;
assign auto_out_a_bits_opcode = {_nodeOut_a_valid_T, 2'h0};
assign auto_out_a_bits_size = {1'h0, io_sizeIn};
assign auto_out_a_bits_address = io_addrIn[31:0];
assign auto_out_a_bits_data = _nodeOut_a_valid_T ? 8'h0 : _GEN[counter[2:0]];
assign io_rdLegal = io_rdLegal_0;
assign io_wrLegal = io_wrLegal_0;
assign io_rdDone = rdTxValid & txLast;
assign io_wrDone = _io_wrDone_T & _d_q_io_deq_valid & d_q_io_deq_ready;
assign io_respError = _d_q_io_deq_bits_denied | _d_q_io_deq_bits_corrupt;
assign io_rdLoad_0 = rdTxValid & counter == 4'h0;
assign io_rdLoad_1 = rdTxValid & counter == 4'h1;
assign io_rdLoad_2 = rdTxValid & counter == 4'h2;
assign io_rdLoad_3 = rdTxValid & counter == 4'h3;
assign io_rdLoad_4 = rdTxValid & counter == 4'h4;
assign io_rdLoad_5 = rdTxValid & counter == 4'h5;
assign io_rdLoad_6 = rdTxValid & counter == 4'h6;
assign io_rdLoad_7 = rdTxValid & counter == 4'h7;
assign io_sbStateOut = sbState;
endmodule