70 lines
2.4 KiB
Systemverilog
70 lines
2.4 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 TLError_1(
|
|
input clock,
|
|
reset,
|
|
output auto_in_a_ready,
|
|
input auto_in_a_valid,
|
|
input [2:0] auto_in_a_bits_opcode,
|
|
input auto_in_d_ready,
|
|
output auto_in_d_valid,
|
|
output [2:0] auto_in_d_bits_opcode,
|
|
output auto_in_d_bits_denied,
|
|
auto_in_d_bits_corrupt
|
|
);
|
|
|
|
wire da_ready;
|
|
wire [2:0] da_bits_opcode;
|
|
wire [7:0][2:0] _GEN = '{3'h4, 3'h4, 3'h2, 3'h1, 3'h1, 3'h1, 3'h0, 3'h0};
|
|
reg idle;
|
|
reg r_counter;
|
|
wire _GEN_0 = idle | ~r_counter;
|
|
wire da_valid = auto_in_a_valid & idle;
|
|
assign da_bits_opcode = _GEN[auto_in_a_bits_opcode];
|
|
reg beatsLeft;
|
|
`ifndef SYNTHESIS
|
|
always @(posedge clock) begin
|
|
if ((`PRINTF_COND_) & ~reset & ~_GEN_0)
|
|
$fwrite(32'h80000002,
|
|
"Assertion failed\n at Error.scala:34 assert (idle || da_first) // we only send Grant, never GrantData => simplified flow control below\n");
|
|
end // always @(posedge)
|
|
`endif // not def SYNTHESIS
|
|
reg state_1;
|
|
wire muxState_1 = beatsLeft ? state_1 : da_valid;
|
|
assign da_ready = auto_in_d_ready & (~beatsLeft | state_1);
|
|
wire nodeIn_d_valid = (~beatsLeft | state_1) & da_valid;
|
|
always @(posedge clock) begin
|
|
if (reset) begin
|
|
idle <= 1'h1;
|
|
r_counter <= 1'h0;
|
|
beatsLeft <= 1'h0;
|
|
state_1 <= 1'h0;
|
|
end
|
|
else begin
|
|
automatic logic r_3 = da_ready & da_valid;
|
|
idle <= ~(r_3 & da_bits_opcode == 3'h4) & idle;
|
|
r_counter <= (~r_3 | r_counter - 1'h1) & r_counter;
|
|
beatsLeft <=
|
|
~(~beatsLeft & auto_in_d_ready) & beatsLeft - (auto_in_d_ready & nodeIn_d_valid);
|
|
if (beatsLeft) begin
|
|
end
|
|
else
|
|
state_1 <= da_valid;
|
|
end
|
|
end // always @(posedge)
|
|
assign auto_in_a_ready = da_ready & idle;
|
|
assign auto_in_d_valid = nodeIn_d_valid;
|
|
assign auto_in_d_bits_opcode = muxState_1 ? da_bits_opcode : 3'h0;
|
|
assign auto_in_d_bits_denied = muxState_1;
|
|
assign auto_in_d_bits_corrupt = muxState_1 & da_bits_opcode[0];
|
|
endmodule
|
|
|