2004-12-11 03:31:25 +01:00
|
|
|
:vpi_module "system";
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
; This example demonstrates a simple blocking assignment to a
|
|
|
|
|
; reg vector within a module.
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main .scope module, "main" "main";
|
|
|
|
|
|
|
|
|
|
; This declares a "reg" data type named "test" in the current scope.
|
|
|
|
|
; The bit range is given for the purposes of VPI access. The range
|
|
|
|
|
; corresponds to the declaration "reg [7:0] test", so leads to an 8
|
|
|
|
|
; bit wide vector.
|
2008-01-02 19:42:23 +01:00
|
|
|
test .var "test", 7 0;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
|
|
|
|
; The %set/v opcode writes a value to the target .var vector. The
|
|
|
|
|
; first operand is the label of the .var object. The second and
|
|
|
|
|
; third operands are the base and width of the bit set that is to
|
|
|
|
|
; be made into the vector to write.
|
|
|
|
|
|
|
|
|
|
T0 %set/v test, 0, 8 ;
|
2008-01-02 19:42:23 +01:00
|
|
|
%vpi_call 0 0 "$display", "test = %b", test;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
|
|
|
|
%set/v test, 1, 8 ;
|
2008-01-02 19:42:23 +01:00
|
|
|
%vpi_call 0 0 "$display", "test = %b", test;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
|
|
|
|
%set/v test, 2, 8 ;
|
2008-01-02 19:42:23 +01:00
|
|
|
%vpi_call 0 0 "$display", "test = %b", test;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
|
|
|
|
%set/v test, 3, 8 ;
|
2008-01-02 19:42:23 +01:00
|
|
|
%vpi_call 0 0 "$display", "test = %b", test;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
|
|
|
|
%end;
|
|
|
|
|
.thread T0;
|
2008-01-02 19:42:23 +01:00
|
|
|
:file_names 2;
|
|
|
|
|
"N/A";
|
|
|
|
|
"<interactive>";
|