Hi ,
- I have following codes ::
class Busop ;
rand bit [1:0] addr ;
rand bit [1:0] io_space_mode ;
constraint c_io { io_space_mode -> ( addr == 3 ) ; }
endclass
Busop b ;
initial begin
b = new() ;
repeat(5)
if ( b.randomize() with { IN-LINE Constraint } ) // I try combinations of IN-LINE Constraint
begin
$display("Success with %p",b);
end
end
(a) If IN-LINE Constraint is :: io_space_mode == 1 ;
I observe output is always '{addr:3, io_space_mode:1}
(b) If IN-LINE Constraint is :: io_space_mode == 0 ;
I observe that in Output io_space_mode is always 0 but addr can be any value from 0 to 3
2. [II] If I modify Constraint to :: constraint c_io { !io_space_mode → ( addr == 3 ) ; }
(a) If IN-LINE Constraint is :: io_space_mode == 0 ;
I observe output is always '{addr:3, io_space_mode:0}
(b) If IN-LINE Constraint is :: io_space_mode == 1 ;
I observe that in Output io_space_mode is always 1 but addr can be any value from 0 to 3
Confusion / My Question arises when ::
3. [III] I modify Constraint to :: constraint c_io { ! ( io_space_mode → addr == 3 ) ; } // I see discrepancy in Simulator Outputs
// ( Some show a Compilation Issue on above Constraint )
(QA) If IN-LINE Constraint is :: io_space_mode == 0 ;
What should be output ?
(QB) If IN-LINE Constraint is :: io_space_mode == 1 ;
What should be output ?
(QC) Is there any issue with constraint III ?