[sv-bc] Elaboration-time assertion macro

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Mon Jul 31 2006 - 09:34:56 PDT
Sometimes it's desirable to assert something about elaboration-time
constants, such as bounds on a parameter, in a way that can be enforced
during compilation.
 
  module test #(N=12) (input [N-1:0] in, output [N-1:0] out);
    `ASSERT((N > 0) && (N <= 8), test_1);
    assign out = in;
  endmodule

 
 
This effect can be achieved by a macro that provokes a compile-time
error when the assertion is unsatisfied.
 
    `define ASSERT(boolean_constant_expression, suffix) \
          logic ELABORATION_TIME_ASSERTION_``suffix [0:$left(int,
((boolean_constant_expression)?1:0))]

 
 
-- Brad
 
 
Received on Mon Jul 31 09:35:08 2006

This archive was generated by hypermail 2.1.8 : Mon Jul 31 2006 - 09:35:15 PDT