Skip to content
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
1 change: 1 addition & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sources:
# etc. Files within a level are ordered alphabetically.

# Level 0
- src/assert_rpt_pkg.sv
- src/cc_binary_to_gray.sv

- target: not(all(xilinx,vivado_ipx))
Expand Down
39 changes: 28 additions & 11 deletions include/common_cells/assertions.svh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
`ifndef COMMON_CELLS_ASSERTIONS_SVH
`define COMMON_CELLS_ASSERTIONS_SVH

`ifdef UVM
// report assertion error with UVM if compiled
package assert_rpt_pkg;
import uvm_pkg::*;
`include "uvm_macros.svh"
function void assert_rpt(string msg);
`uvm_error("ASSERT FAILED", msg)
endfunction
endpackage
`endif

///////////////////
// Helper macros //
///////////////////
Expand All @@ -39,6 +28,34 @@
`endif
`endif

// detect and resolve potential collision with lowRISC's prim_assert macros by undefining all of
// their macros (the variants in here should be backwards compatible with lowRISC's macros)
`ifdef PRIM_ASSERT_SV
`ifdef INC_ASSERT
`undef ASSERT_I
`undef ASSERT_INIT
`undef ASSERT_FINAL
`undef ASSERT
`undef ASSERT_NEVER
`undef ASSERT_KNOWN
`undef COVER
`undef ASSERT_PULSE
`undef ASSERT_IF
`ifndef FPV_ON
`undef ASSERT_KNOWN_IF
`endif
`undef ASSUME
`undef ASSUME_I
`endif
`ifdef FPV_ON
`undef ASSUME_FPV
`undef ASSUME_I_FPV
`undef COVER_FPV
`endif
`endif
// define PRIM_ASSERT_SV to anticipate a later inclusion of lowRISC's prim_assert macros
`define PRIM_ASSERT_SV

// Converts an arbitrary block of code into a Verilog string
`define ASSERT_STRINGIFY(__x) `"__x`"

Expand Down
17 changes: 17 additions & 0 deletions src/assert_rpt_pkg.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifdef UVM
package assert_rpt_pkg;

import uvm_pkg::*;

`include "uvm_macros.svh"

function automatic void assert_rpt(string msg);
`uvm_error("ASSERT FAILED", msg)
endfunction

endpackage
`endif
Loading