diff --git a/parse.y b/parse.y index 4ddf96132..eef078c8f 100644 --- a/parse.y +++ b/parse.y @@ -590,7 +590,7 @@ static void current_function_set_statement(const YYLTYPE&loc, std::vector number pos_neg_number %type signing unsigned_signed_opt signed_unsigned_opt %type import_export -%type K_genvar_opt K_reg_opt K_static_opt K_virtual_opt +%type K_genvar_opt K_static_opt K_virtual_opt %type udp_reg_opt edge_operator %type drive_strength drive_strength_opt dr_strength0 dr_strength1 %type udp_input_sym udp_output_sym @@ -2104,13 +2104,6 @@ random_qualifier /* IEEE1800-2005 A.1.8 */ | K_randc { $$ = property_qualifier_t::make_randc(); } ; - /* real and realtime are exactly the same so save some code - * with a common matching rule. */ -real_or_realtime - : K_real - | K_realtime - ; - signing /* IEEE1800-2005: A.2.2.1 */ : K_signed { $$ = true; } | K_unsigned { $$ = false; } @@ -2353,50 +2346,9 @@ task_declaration /* IEEE1800-2005: A.2.7 */ tf_port_declaration /* IEEE1800-2005: A.2.7 */ - : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' - { std::vector*tmp = pform_make_task_ports(@1, $1, - $2 ? IVL_VT_LOGIC : - IVL_VT_NO_TYPE, - $3, $4, $5); - $$ = tmp; + : port_direction data_type_or_implicit list_of_identifiers ';' + { $$ = pform_make_task_ports(@1, $1, $2, $3, true); } - - /* When the port is an integer, infer a signed vector of the integer - shape. Generate a range ([31:0]) to make it work. */ - - | port_direction K_integer list_of_identifiers ';' - { std::list*range_stub = make_range_from_width(integer_width); - vector*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true, - range_stub, $3, true); - $$ = tmp; - } - - /* Ports can be time with a width of [63:0] (unsigned). */ - - | port_direction K_time list_of_identifiers ';' - { std::list*range_stub = make_range_from_width(64); - vector*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false, - range_stub, $3); - $$ = tmp; - } - - /* Ports can be real or realtime. */ - - | port_direction real_or_realtime list_of_identifiers ';' - { std::vector*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true, - 0, $3); - $$ = tmp; - } - - - /* Ports can be string. */ - - | port_direction K_string list_of_identifiers ';' - { std::vector*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true, - 0, $3); - $$ = tmp; - } - ; @@ -7244,6 +7196,5 @@ unique_priority collect those rules here. */ K_genvar_opt : K_genvar { $$ = true; } | { $$ = false; } ; -K_reg_opt : K_reg { $$ = true; } | { $$ = false; } ; K_static_opt : K_static { $$ = true; } | { $$ = false; } ; K_virtual_opt : K_virtual { $$ = true; } | { $$ = false; } ; diff --git a/pform.cc b/pform.cc index f9f7a3237..8184c7802 100644 --- a/pform.cc +++ b/pform.cc @@ -2923,13 +2923,13 @@ void pform_makewire(const struct vlltype&li, * constraints as those of tasks, so this works fine. Functions have * no output or inout ports. */ -vector*pform_make_task_ports(const struct vlltype&loc, - NetNet::PortType pt, - ivl_variable_type_t vtype, - bool signed_flag, - list*range, - list*names, - bool isint) +static vector*pform_make_task_ports(const struct vlltype&loc, + NetNet::PortType pt, + ivl_variable_type_t vtype, + bool signed_flag, + list*range, + list*names, + bool isint = false) { assert(pt != NetNet::PIMPLICIT && pt != NetNet::NOT_A_PORT); assert(names); @@ -2999,7 +2999,8 @@ static vector*do_make_task_ports(const struct vlltype&loc, vector*pform_make_task_ports(const struct vlltype&loc, NetNet::PortType pt, data_type_t*vtype, - list*names) + list*names, + bool allow_implicit) { vector*ret = NULL; std::list*unpacked_dims = NULL; @@ -3017,7 +3018,11 @@ vector*pform_make_task_ports(const struct vlltype&loc, } if (vector_type_t*vec_type = dynamic_cast (vtype)) { - ret = pform_make_task_ports(loc, pt, vec_type->base_type, + ivl_variable_type_t base_type = vec_type->base_type; + if (allow_implicit && vec_type->implicit_flag) + base_type = IVL_VT_NO_TYPE; + + ret = pform_make_task_ports(loc, pt, base_type, vec_type->signed_flag, copy_range(vec_type->pdims.get()), names, vec_type->integer_flag); diff --git a/pform.h b/pform.h index 687dee9bd..02c22f32f 100644 --- a/pform.h +++ b/pform.h @@ -492,20 +492,11 @@ extern void pform_make_pgassign_list(std::list*alist, struct str_pair_t str, const char* fn, unsigned lineno); -/* Given a port type and a list of names, make a list of wires that - can be used as task port information. */ -extern std::vector*pform_make_task_ports(const struct vlltype&loc, - NetNet::PortType pt, - ivl_variable_type_t vtype, - bool signed_flag, - std::list*range, - std::list*names, - bool isint = false); - extern std::vector*pform_make_task_ports(const struct vlltype&loc, NetNet::PortType pt, data_type_t*vtype, - std::list*names); + std::list*names, + bool allow_implicit = false); /* * The parser uses this function to convert a unary