maxlin
02-04-2008, 09:13 AM
hello,
can `field_ovm_int be used for reals (which are integral types, aren't they)?
because somehow this doesn't work as expected:
import ovm_pkg::*;
`include "ovm_macros.svh"
class trx extends ovm_transaction;
real r;
int i;
`ovm_object_utils_begin(trx)
`ovm_field_int(r, OVM_DEFAULT)
`ovm_field_int(i, OVM_DEFAULT)
`ovm_object_utils_end
endclass
program test;
initial begin
trx a, b;
a = new(); a.r = 1.0; a.i = 2;
$cast(b, a.clone());
$display("a.r: ", a.r, " b.r: ", b.r);
$display("a.i: ", a.i, " b.i: ", b.i);
end
endprogramresults in:
VSIM 1> run -all
# a.r: 1 b.r: 0
# a.i: 2 b.i: 2
thank you!
m.
can `field_ovm_int be used for reals (which are integral types, aren't they)?
because somehow this doesn't work as expected:
import ovm_pkg::*;
`include "ovm_macros.svh"
class trx extends ovm_transaction;
real r;
int i;
`ovm_object_utils_begin(trx)
`ovm_field_int(r, OVM_DEFAULT)
`ovm_field_int(i, OVM_DEFAULT)
`ovm_object_utils_end
endclass
program test;
initial begin
trx a, b;
a = new(); a.r = 1.0; a.i = 2;
$cast(b, a.clone());
$display("a.r: ", a.r, " b.r: ", b.r);
$display("a.i: ", a.i, " b.i: ", b.i);
end
endprogramresults in:
VSIM 1> run -all
# a.r: 1 b.r: 0
# a.i: 2 b.i: 2
thank you!
m.