i 0 i 256 i begin data display data 0d data end end endmodule Data flips value

I 0 i 256 i begin data display data 0d data end end

This preview shows page 10 - 16 out of 32 pages.

i = 0; i < 256; i++) begin data++; $display ("data : %0d", data); end end endmodule Data flips value from 127 to - 128 as it increments due to being signed
Image of page 10
SystemVerilog [Verification] Data-Types 2-State Data-Types bit S ystemVerilog introduces 2-state data types to improve simulator performance and reduce memory usage, compared with variables declared as 4-state types. For example, we can use bit , a single bit 2- state variable, i.e. it can only be ‘0’ or ‘1’. bit b ; // 2-state, single-bit bit [ 31 : 0 ] b32 ; // 2-state, 32-bit unsigned integer initial begin b = 1 ; b = x ; // Error, cannot assign values X or Z to data-type bit. b32 = 1 ; b32 = -1 ; // Error, cannot assign a signed value to unsigned integer. end B e careful connecting 2-state variables to the design under test, especially its outputs. If the hardware tries to drive an X or Z, these values are converted to a 2-state value, and your test bench code may never know. Advanced Hardware Design & Verification SystemVerilog [email protected] 11
Image of page 11
SystemVerilog [Verification] Data-Types Arrays Fixed Size Arrays Visualization of Unpacked Multi-Dimensional Arrays [3:0] [1:0] [7:0] [2:0] F or this declaration, the largest accessible unit is 1-bit. logic my_array [ 3 : 0 ][ 2 : 0 ][ 1 : 0 ][ 7 : 0 ]; R ow C olumn Advanced Hardware Design & Verification SystemVerilog [email protected] 12
Image of page 12