mrforever Posted April 1, 2013 Report Share Posted April 1, 2013 Hi, experts, I met one problem when i use type_id::create() to create one instance of a component object. Here are my codes: typedef class tmp_for_test; class config_agent extends uvm_agent; typedef config_agent this_type; tmp_for_test #(int, byte) tmp_f_t; // Provide implmentations of virtual methods such as get_type_name and create `uvm_component_utils_begin(config_agent) `uvm_field_object(tmp_f_t, UVM_DEFAULT); `uvm_component_utils_end // new function new (string name, uvm_component parent); super.new(name, parent); endfunction : new // build_phase function void build_phase(uvm_phase phase); super.build_phase(phase); ... tmp_f_t = tmp_for_test#(int, byte)::type_id::create("tmp_f_t", this); ... endfunction: build_phase ... endclass: config_agent class tmp_for_test #(type T1=int, type T2=T1) extends uvm_component; T1 width; T2 depth; // Provide implmentations of virtual methods such as get_type_name and create `uvm_component_utils(tmp_for_test) function new (string name, uvm_component parent); super.new(name, parent); ... endfunction function void build_phase(uvm_phase phase); super.build_phase(phase); endfunction: build_phase ... endclass : tmp_for_test The VCS reports such an error: Error-[sV-ICA] Illegal class assignment ../sv_for_tmptest/02_master/config/config_agent.sv, 254 "this.tmp_f_t = uvm_pkg_uvm_component_registry_541795153::create("tmp_f_t", this, "\000");" Expression 'uvm_pkg_uvm_component_registry_541795153::create("tmp_f_t", this, "\000")' on rhs is not a class or a compatible class and hence cannot be assigned to a class handle on lhs. Please make sure that the lhs and rhs expressions are compatible. But it's okay when i use config_driver which extends uvm_driver replacing the class tmp_for test. Does anybody meet the same problem or know the reason? Thanks in advance Quote Link to comment Share on other sites More sharing options...
mrforever Posted April 1, 2013 Author Report Share Posted April 1, 2013 Hi, all I have found the reason of this problem. It's that the type of the second paramter(byte type) of class tmp_for_test isn't identify with the defaut type, which is int type. If change the type of the second paramter from byte to int, the error disappears. But I have another question: If I want to use different type of the paramter of class tmp_for_test and instantiate it via the way of using type_id::create("tmp_f_t", this), how can i do? regards mrforever Quote Link to comment Share on other sites More sharing options...
apfitch Posted April 1, 2013 Report Share Posted April 1, 2013 You need to use the macros `uvm_component_param_utils* See the class reference for details, regards Alan Quote Link to comment Share on other sites More sharing options...
mrforever Posted April 2, 2013 Author Report Share Posted April 2, 2013 You need to use the macros `uvm_component_param_utils* See the class reference for details, regards Alan Thanks, Alan. I will have a try. Quote Link to comment Share on other sites More sharing options...
mrforever Posted April 2, 2013 Author Report Share Posted April 2, 2013 You need to use the macros `uvm_component_param_utils* See the class reference for details, regards Alansu Thanks, Alan. I have solved it. Could you give me some suggestions about my another question? The subject is "problem about multiple sequencers which have the same name" regards mrforever Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.