maxlin
01-14-2008, 01:17 AM
Hi,
Components sometimes have more than just one interface, e. g. one for data flow and the other one for control information.
I'd like to implement this with several ovm_*_imps which forward to different tasks (say, put() for data flow und control_put() for control information).
Initially, I came up with this "solution":
class control_put_imp #(type T = int, type IMP = int)
extends ovm_blocking_put_imp #(T, IMP);
local IMP m_imp;
function new(string name, IMP imp);
super.new(name, imp);
m_imp = imp;
endfunction : new
task put(input T t);
m_imp.control_put(t);
endtask : put
endclass : control_put_imp
but, unfortunately, this doesn't work:
# ** Error: (vsim-3978) .../ovm/ovm-1.0/src/tlm/ovm_imps.svh(37): Illegal assignment to variable of class xxx_trx from variable of class yyy_trx
The next version does work, but will probably break when OVM internals change:
//
// we can not include src/tlm/tlm_ifs.svh to define `TLM_BLOCKING_PUT_MASK
// because mixing package and include technique will result in type errors
// (ovm_pkg::ovm_... vs. ovm_...)
//
class control_put_imp #(type T = int, type IMP = int)
extends ovm_port_base #(tlm_if_base #(T, T));
local IMP m_imp;
function new(string name, IMP imp);
super.new(name, imp, OVM_IMPLEMENTATION, 1, 1);
m_if = this;
m_imp = imp;
m_if_mask = (1<<0); //`TLM_BLOCKING_PUT_MASK;
m_if_name = "tlm_blocking_put";
assert(this.m_connector.add_if(m_if));
endfunction
task put(input T t);
m_imp.control_put(t);
endtask
endclass
Is there a cleaner way to implement such a functionality?
Thank you!
m.
Components sometimes have more than just one interface, e. g. one for data flow and the other one for control information.
I'd like to implement this with several ovm_*_imps which forward to different tasks (say, put() for data flow und control_put() for control information).
Initially, I came up with this "solution":
class control_put_imp #(type T = int, type IMP = int)
extends ovm_blocking_put_imp #(T, IMP);
local IMP m_imp;
function new(string name, IMP imp);
super.new(name, imp);
m_imp = imp;
endfunction : new
task put(input T t);
m_imp.control_put(t);
endtask : put
endclass : control_put_imp
but, unfortunately, this doesn't work:
# ** Error: (vsim-3978) .../ovm/ovm-1.0/src/tlm/ovm_imps.svh(37): Illegal assignment to variable of class xxx_trx from variable of class yyy_trx
The next version does work, but will probably break when OVM internals change:
//
// we can not include src/tlm/tlm_ifs.svh to define `TLM_BLOCKING_PUT_MASK
// because mixing package and include technique will result in type errors
// (ovm_pkg::ovm_... vs. ovm_...)
//
class control_put_imp #(type T = int, type IMP = int)
extends ovm_port_base #(tlm_if_base #(T, T));
local IMP m_imp;
function new(string name, IMP imp);
super.new(name, imp, OVM_IMPLEMENTATION, 1, 1);
m_if = this;
m_imp = imp;
m_if_mask = (1<<0); //`TLM_BLOCKING_PUT_MASK;
m_if_name = "tlm_blocking_put";
assert(this.m_connector.add_if(m_if));
endfunction
task put(input T t);
m_imp.control_put(t);
endtask
endclass
Is there a cleaner way to implement such a functionality?
Thank you!
m.