Allow for class objects an class properties.

This commit is contained in:
Stephen Williams 2013-01-27 19:52:43 -08:00
parent 4568766cff
commit d8592b1444
3 changed files with 16 additions and 1 deletions

View File

@ -19,6 +19,7 @@
# include "pform_types.h"
# include "netlist.h"
# include "netclass.h"
# include "netdarray.h"
# include "netscalar.h"
# include "netvector.h"
@ -71,6 +72,11 @@ ivl_type_s* atom2_type_t::elaborate_type(Design*des, NetScope*) const
}
}
ivl_type_s* class_type_t::elaborate_type(Design*des, NetScope*scope) const
{
return scope->find_class(name);
}
ivl_type_s* real_type_t::elaborate_type(Design*, NetScope*) const
{
switch (type_code) {

View File

@ -212,8 +212,9 @@ struct class_type_t : public data_type_t {
void pform_dump(std::ostream&out, unsigned indent) const;
perm_string name;
std::map<perm_string, data_type_t*> properties;
ivl_type_s* elaborate_type(Design*, NetScope*) const;
};
class property_qualifier_t {

View File

@ -889,6 +889,14 @@ static int show_stmt_assign_sig_cobject(ivl_statement_t net)
fprintf(vvp_out, " %%store/prop/obj %d;\n", prop_idx);
fprintf(vvp_out, " %%pop/obj 1;\n");
} else if (ivl_type_base(prop_type) == IVL_VT_CLASS) {
/* The property is a class object. */
fprintf(vvp_out, " %%load/obj v%p_0;\n", sig);
draw_eval_object(rval);
fprintf(vvp_out, " %%store/prop/obj %d;\n", prop_idx);
fprintf(vvp_out, " %%pop/obj 1;\n");
} else {
fprintf(vvp_out, " ; ERROR: ivl_type_base(prop_type) = %d\n",
ivl_type_base(prop_type));