Merge pull request #806 from larsclausen/class-sig-elab
Elaborate class properties during signal phase instead of scope phase
This commit is contained in:
commit
15b4a8a046
|
|
@ -511,29 +511,6 @@ static void elaborate_scope_class(Design*des, NetScope*scope, PClass*pclass)
|
|||
}
|
||||
elaborate_scope_enumerations(des, class_scope, pclass->enum_sets);
|
||||
|
||||
// Collect the properties, elaborate them, and add them to the
|
||||
// elaborated class definition.
|
||||
for (map<perm_string, class_type_t::prop_info_t>::iterator cur = use_type->properties.begin()
|
||||
; cur != use_type->properties.end() ; ++ cur) {
|
||||
|
||||
ivl_type_t tmp = cur->second.type->elaborate_type(des, class_scope);
|
||||
ivl_assert(*pclass, tmp);
|
||||
if (debug_scopes) {
|
||||
cerr << pclass->get_fileline() << ": elaborate_scope_class: "
|
||||
<< " Property " << cur->first
|
||||
<< " type=" << *tmp << endl;
|
||||
}
|
||||
|
||||
if (dynamic_cast<const netqueue_t *> (tmp)) {
|
||||
cerr << cur->second.get_fileline() << ": sorry: "
|
||||
<< "Queues inside classes are not yet supported." << endl;
|
||||
des->errors++;
|
||||
}
|
||||
|
||||
use_class->set_property(cur->first, cur->second.qual, tmp);
|
||||
|
||||
}
|
||||
|
||||
for (map<perm_string,PTask*>::iterator cur = pclass->tasks.begin()
|
||||
; cur != pclass->tasks.end() ; ++cur) {
|
||||
|
||||
|
|
|
|||
17
elab_sig.cc
17
elab_sig.cc
|
|
@ -374,9 +374,25 @@ bool Module::elaborate_sig(Design*des, NetScope*scope) const
|
|||
|
||||
void netclass_t::elaborate_sig(Design*des, PClass*pclass)
|
||||
{
|
||||
// Collect the properties, elaborate them, and add them to the
|
||||
// elaborated class definition.
|
||||
for (map<perm_string,struct class_type_t::prop_info_t>::iterator cur = pclass->type->properties.begin()
|
||||
; cur != pclass->type->properties.end() ; ++ cur) {
|
||||
|
||||
ivl_type_t use_type = cur->second.type->elaborate_type(des, class_scope_);
|
||||
if (debug_scopes) {
|
||||
cerr << pclass->get_fileline() << ": elaborate_scope_class: "
|
||||
<< " Property " << cur->first
|
||||
<< " type=" << *use_type << endl;
|
||||
}
|
||||
|
||||
if (dynamic_cast<const netqueue_t *> (use_type)) {
|
||||
cerr << cur->second.get_fileline() << ": sorry: "
|
||||
<< "Queues inside classes are not yet supported." << endl;
|
||||
des->errors++;
|
||||
}
|
||||
set_property(cur->first, cur->second.qual, use_type);
|
||||
|
||||
if (! cur->second.qual.test_static())
|
||||
continue;
|
||||
|
||||
|
|
@ -388,7 +404,6 @@ void netclass_t::elaborate_sig(Design*des, PClass*pclass)
|
|||
}
|
||||
|
||||
list<netrange_t> nil_list;
|
||||
ivl_type_t use_type = cur->second.type->elaborate_type(des, class_scope_);
|
||||
/* NetNet*sig = */ new NetNet(class_scope_, cur->first, NetNet::REG,
|
||||
nil_list, use_type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
// Check that it is possible to use a package scope type identifier for the type
|
||||
// of a property of class defined in the root scope
|
||||
|
||||
package P;
|
||||
typedef integer T;
|
||||
endpackage
|
||||
|
||||
class C;
|
||||
P::T x;
|
||||
endclass
|
||||
|
||||
module test;
|
||||
C c;
|
||||
initial begin
|
||||
c = new;
|
||||
c.x = 32'h55aa55aa;
|
||||
if (c.x === 32'h55aa55aa) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// Check that it is possible to use a forward declared class type as the type of
|
||||
// a property in another class.
|
||||
|
||||
module test;
|
||||
|
||||
typedef class B;
|
||||
|
||||
class C;
|
||||
B b;
|
||||
endclass
|
||||
|
||||
class B;
|
||||
endclass
|
||||
|
||||
C c;
|
||||
|
||||
initial begin
|
||||
c = new;
|
||||
$display("PASSED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -645,6 +645,7 @@ sv_ps_type1 normal,-g2009 ivltests
|
|||
sv_ps_type_cast1 normal,-g2009 ivltests
|
||||
sv_ps_type_cast2 normal,-g2009 ivltests
|
||||
sv_ps_type_class1 normal,-g2009 ivltests
|
||||
sv_ps_type_class_prop normal,-g2009 ivltests
|
||||
sv_ps_type_enum1 normal,-g2009 ivltests
|
||||
sv_ps_type_expr1 normal,-g2009 ivltests
|
||||
sv_ps_type_expr2 normal,-g2009 ivltests
|
||||
|
|
@ -738,6 +739,7 @@ sv_typedef_darray_base3 normal,-g2009 ivltests
|
|||
sv_typedef_darray_base4 normal,-g2009 ivltests
|
||||
sv_typedef_fwd_base normal,-g2009 ivltests
|
||||
sv_typedef_fwd_class normal,-g2009 ivltests
|
||||
sv_typedef_fwd_class2 normal,-g2009 ivltests
|
||||
sv_typedef_fwd_union normal,-g2009 ivltests
|
||||
sv_typedef_fwd_union_fail CE,-g2009 ivltests
|
||||
sv_typedef_fwd_enum1 normal,-g2009 ivltests
|
||||
|
|
|
|||
|
|
@ -440,8 +440,10 @@ sv_port_default7 CE,-g2009,-pallowsigned=1 ivltests
|
|||
sv_port_default8 CE,-g2009,-pallowsigned=1 ivltests
|
||||
sv_port_default9 CE,-g2009 ivltests
|
||||
sv_ps_type_class1 CE,-g2009 ivltests
|
||||
sv_ps_type_class_prop CE,-g2009 ivltests
|
||||
sv_root_class CE,-g2009 ivltests
|
||||
sv_typedef_fwd_class CE,-g2009 ivltests
|
||||
sv_typedef_fwd_class2 CE,-g2009 ivltests
|
||||
sv_typedef_fwd_enum3 CE,-g2009 ivltests
|
||||
sv_typedef_scope3 CE,-g2009 ivltests
|
||||
sv_unit2b CE,-g2009 ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue