Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed translate_off to ` ifndef SYNTHESIS `` #210

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/addr_decode_dync.sv
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module addr_decode_dync #(
// Assumptions and assertions
`ifndef COMMON_CELLS_ASSERTS_OFF
`ifndef XSIM
// pragma translate_off
`ifndef SYNTHESIS
initial begin : proc_check_parameters
assume ($bits(addr_i) == $bits(addr_map_i[0].start_addr)) else
$warning($sformatf("Input address has %d bits and address map has %d bits.",
Expand Down Expand Up @@ -184,7 +184,7 @@ module addr_decode_dync #(
end
end
end
// pragma translate_on
`endif
`endif
`endif

Expand Down
4 changes: 2 additions & 2 deletions src/cb_filter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ module hash_block #(

`ifndef COMMON_CELLS_ASSERTS_OFF
// assertions
// pragma translate_off
`ifndef SYNTHESIS
initial begin
hash_conf: assume (InpWidth > HashWidth) else
$fatal(1, "%m:\nA Hash Function reduces the width of the input>\nInpWidth: %s\nOUT_WIDTH: %s",
InpWidth, HashWidth);
end
// pragma translate_on
`endif
`endif
endmodule
4 changes: 2 additions & 2 deletions src/cdc_2phase_clearable.sv
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ module cdc_2phase_src_clearable #(

// Assertions
`ifndef COMMON_CELLS_ASSERTS_OFF
// pragma translate_off
`ifndef SYNTHESIS
no_clear_and_request: assume property (
@(posedge clk_i) disable iff(~rst_ni) (clear_i |-> ~valid_i))
else $fatal(1, "No request allowed while clear_i is asserted.");

// pragma translate_on
`endif
`endif

endmodule
Expand Down
4 changes: 2 additions & 2 deletions src/cdc_fifo_2phase.sv
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ module cdc_fifo_2phase #(
);

// Check the invariants.
//pragma translate_off
`ifndef SYNTHESIS
initial begin
assert(LOG_DEPTH > 0);
end
//pragma translate_on
`endif

localparam int PtrWidth = LOG_DEPTH+1;
typedef logic [PtrWidth-1:0] pointer_t;
Expand Down
4 changes: 2 additions & 2 deletions src/cdc_fifo_gray.sv
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ module cdc_fifo_gray #(
);

// Check the invariants.
// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial assert(LOG_DEPTH > 0);
initial assert(SYNC_STAGES >= 2);
`endif
// pragma translate_on
`endif

endmodule

Expand Down
4 changes: 2 additions & 2 deletions src/cdc_fifo_gray_clearable.sv
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ module cdc_fifo_gray_clearable #(
assign dst_clear_pending_o = s_dst_isolate_req;

// Check the invariants.
// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial assert(LOG_DEPTH > 0);
initial assert(SYNC_STAGES >= 2);
`endif
// pragma translate_on
`endif

endmodule

Expand Down
4 changes: 2 additions & 2 deletions src/cf_math_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package cf_math_pkg;
function automatic integer ceil_div (input longint dividend, input longint divisor);
automatic longint remainder;

// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
if (dividend < 0) begin
$fatal(1, "Dividend %0d is not a natural number!", dividend);
Expand All @@ -37,7 +37,7 @@ package cf_math_pkg;
$fatal(1, "Division by zero!");
end
`endif
// pragma translate_on
`endif

remainder = dividend;
for (ceil_div = 0; remainder > 0; ceil_div++) begin
Expand Down
4 changes: 2 additions & 2 deletions src/deprecated/fifo_v2.sv
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ module fifo_v2 #(
.pop_i
);

// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial begin
assert (ALM_FULL_TH <= DEPTH) else $error("ALM_FULL_TH can't be larger than the DEPTH.");
assert (ALM_EMPTY_TH <= DEPTH) else $error("ALM_EMPTY_TH can't be larger than the DEPTH.");
end
`endif
// pragma translate_on
`endif

endmodule // fifo_v2
4 changes: 2 additions & 2 deletions src/deprecated/find_first_one.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ module find_first_one #(

localparam int NUM_LEVELS = $clog2(WIDTH);

// pragma translate_off
`ifndef SYNTHESIS
initial begin
assert(WIDTH >= 0);
end
// pragma translate_on
`endif

logic [WIDTH-1:0][NUM_LEVELS-1:0] index_lut;
logic [2**NUM_LEVELS-1:0] sel_nodes;
Expand Down
4 changes: 2 additions & 2 deletions src/deprecated/generic_fifo.sv
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module generic_fifo
int unsigned i;

// Parameter Check
// synopsys translate_off
`ifndef SYNTHESIS
initial begin : parameter_check
integer param_err_flg;
param_err_flg = 0;
Expand All @@ -85,7 +85,7 @@ module generic_fifo
$display("ERROR: %m :\n Invalid value (%d) for parameter DATA_DEPTH (legal range: greater than 1)", DATA_DEPTH );
end
end
// synopsys translate_on
`endif

`ifndef PULP_FPGA_EMUL
cluster_clock_gating cg_cell
Expand Down
4 changes: 2 additions & 2 deletions src/deprecated/generic_fifo_adv.sv
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module generic_fifo_adv
int unsigned i;

// Parameter Check
// synopsys translate_off
`ifndef SYNTHESIS
initial
begin : parameter_check
integer param_err_flg;
Expand All @@ -66,7 +66,7 @@ module generic_fifo_adv
$display("ERROR: %m :\n Invalid value (%d) for parameter DATA_DEPTH (legal range: greater than 1)", DATA_DEPTH );
end
end
// synopsys translate_on
`endif

`ifndef PULP_FPGA_EMUL
cluster_clock_gating cg_cell
Expand Down
4 changes: 2 additions & 2 deletions src/exp_backoff.sv
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module exp_backoff #(
// assertions
///////////////////////////////////////////////////////

//pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial begin
// assert wrong parameterizations
Expand All @@ -93,6 +93,6 @@ module exp_backoff #(
else $fatal(1,"Zero seed is not allowed for LFSR");
end
`endif
//pragma translate_on
`endif

endmodule // exp_backoff
4 changes: 2 additions & 2 deletions src/fifo_v3.sv
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module fifo_v3 #(
end
end

// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial begin
assert (DEPTH > 0) else $error("DEPTH must be greater than 0.");
Expand All @@ -151,6 +151,6 @@ module fifo_v3 #(
@(posedge clk_i) disable iff (~rst_ni) (empty_o |-> ~pop_i))
else $fatal (1, "Trying to pop data although the FIFO is empty.");
`endif
// pragma translate_on
`endif

endmodule // fifo_v3
4 changes: 2 additions & 2 deletions src/id_queue.sv
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ module id_queue #(
end

// Validate parameters.
// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial begin: validate_params
assert (ID_WIDTH >= 1)
Expand All @@ -413,6 +413,6 @@ module id_queue #(
else $fatal(1, "The queue must have capacity of at least one entry!");
end
`endif
// pragma translate_on
`endif

endmodule
4 changes: 2 additions & 2 deletions src/isochronous_4phase_handshake.sv
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ module isochronous_4phase_handshake (
// destination is valid if we didn't yet get acknowledge
assign dst_valid_o = (dst_req_q != dst_ack_q);

// pragma translate_off
`ifndef SYNTHESIS
// stability guarantees
`ifndef COMMON_CELLS_ASSERTS_OFF
assert property (@(posedge src_clk_i) disable iff (~src_rst_ni)
(src_valid_i && !src_ready_o |=> $stable(src_valid_i))) else $error("src_valid_i is unstable");
assert property (@(posedge dst_clk_i) disable iff (~dst_rst_ni)
(dst_valid_o && !dst_ready_i |=> $stable(dst_valid_o))) else $error("dst_valid_o is unstable");
`endif
// pragma translate_on
`endif

endmodule
4 changes: 2 additions & 2 deletions src/isochronous_spill_register.sv
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module isochronous_spill_register #(
assign dst_data_o = mem_q[rd_pointer_q[0]];
end

// pragma translate_off
`ifndef SYNTHESIS
// stability guarantees
`ifndef COMMON_CELLS_ASSERTS_OFF
assert property (@(posedge src_clk_i) disable iff (~src_rst_ni)
Expand All @@ -107,5 +107,5 @@ module isochronous_spill_register #(
assert property (@(posedge dst_clk_i) disable iff (~dst_rst_ni)
(dst_valid_o && !dst_ready_i |=> $stable(dst_data_o))) else $error("dst_data_o is unstable");
`endif
// pragma translate_on
`endif
endmodule
4 changes: 2 additions & 2 deletions src/lfsr.sv
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ end
// assertions
////////////////////////////////////////////////////////////////////////
`ifndef COMMON_CELLS_ASSERTS_OFF
// pragma translate_off
`ifndef SYNTHESIS
initial begin
// these are the LUT limits
assert(OutWidth <= LfsrWidth) else
Expand All @@ -308,7 +308,7 @@ end
all_zero: assert property (
@(posedge clk_i) disable iff (!rst_ni) en_i |-> lfsr_d)
else $fatal(1,"Lfsr must not be all-zero.");
// pragma translate_on
`endif
`endif

endmodule // lfsr
4 changes: 2 additions & 2 deletions src/lfsr_16bit.sv
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ module lfsr_16bit #(
end

`ifndef COMMON_CELLS_ASSERTS_OFF
//pragma translate_off
`ifndef SYNTHESIS
initial begin
assert (WIDTH <= 16)
else $fatal(1, "WIDTH needs to be less than 16 because of the 16-bit LFSR");
end
//pragma translate_on
`endif
`endif

endmodule
4 changes: 2 additions & 2 deletions src/lfsr_8bit.sv
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ module lfsr_8bit #(
end

`ifndef COMMON_CELLS_ASSERTS_OFF
//pragma translate_off
`ifndef SYNTHESIS
initial begin
assert (WIDTH <= 8) else $fatal(1, "WIDTH needs to be less than 8 because of the 8-bit LFSR");
end
//pragma translate_on
`endif
`endif

endmodule
8 changes: 4 additions & 4 deletions src/lzc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ module lzc #(
localparam int unsigned NumLevels = $clog2(WIDTH);

`ifndef COMMON_CELLS_ASSERTS_OFF
// pragma translate_off
`ifndef SYNTHESIS
initial begin
assert(WIDTH > 0) else $fatal(1, "input must be at least one bit wide");
end
// pragma translate_on
`endif
`endif

logic [WIDTH-1:0][NumLevels-1:0] index_lut;
Expand Down Expand Up @@ -101,13 +101,13 @@ module lzc #(

end : gen_lzc

// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
initial begin: validate_params
assert (WIDTH >= 1)
else $fatal(1, "The WIDTH must at least be one bit wide!");
end
`endif
// pragma translate_on
`endif

endmodule : lzc
4 changes: 2 additions & 2 deletions src/mem_to_banks_detailed.sv
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module mem_to_banks_detailed #(
assign rvalid_o = &(resp_valid | dead_response);

// Assertions
// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
`ifndef SYNTHESIS
initial begin
Expand All @@ -221,5 +221,5 @@ module mem_to_banks_detailed #(
end
`endif
`endif
// pragma translate_on
`endif
endmodule
4 changes: 2 additions & 2 deletions src/multiaddr_decode.sv
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module multiaddr_decode #(
// Assumptions and assertions
`ifndef COMMON_CELLS_ASSERTS_OFF
`ifndef XSIM
// pragma translate_off
`ifndef SYNTHESIS
initial begin : proc_check_parameters
assume (NoRules > 0) else
$fatal(1, $sformatf("At least one rule needed"));
Expand All @@ -148,7 +148,7 @@ module multiaddr_decode #(
end
end

// pragma translate_on
`endif
`endif
`endif
endmodule
4 changes: 2 additions & 2 deletions src/onehot_to_bin.sv
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ module onehot_to_bin #(
assign bin[j] = |(tmp_mask & onehot);
end

// pragma translate_off
`ifndef SYNTHESIS
`ifndef COMMON_CELLS_ASSERTS_OFF
assert final ($onehot0(onehot)) else
$fatal(1, "[onehot_to_bin] More than two bit set in the one-hot signal");
`endif
// pragma translate_on
`endif
endmodule
Loading
Loading