diff --git a/PWire.cc b/PWire.cc index 83bcc8374..fea4b7452 100644 --- a/PWire.cc +++ b/PWire.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -58,7 +58,15 @@ bool PWire::set_wire_type(NetNet::Type t) type_ = t; return true; case NetNet::IMPLICIT_REG: - if (t == NetNet::REG) { type_ = t; return true; } + if (t == NetNet::REG) { + type_ = t; + return true; + } + if (t == NetNet::INTEGER) { + type_ = NetNet::REG; + isint_ = true; + return true; + } return false; case NetNet::REG: if (t == NetNet::INTEGER) { diff --git a/parse.y b/parse.y index ef8b3c158..dd2b066aa 100644 --- a/parse.y +++ b/parse.y @@ -388,7 +388,7 @@ static list* make_named_number(perm_string name, PExpr*val =0) %type from_exclude %type number -%type unsigned_signed_opt signed_unsigned_opt +%type unsigned_signed_opt signed_unsigned_opt reg_opt %type udp_reg_opt edge_operator automatic_opt %type drive_strength drive_strength_opt dr_strength0 dr_strength1 %type udp_input_sym udp_output_sym @@ -4287,30 +4287,32 @@ task_item ; reg_opt - : K_reg - | + : K_reg { $$ = true; } + | { $$ = false; } ; task_port_item - : K_input reg_opt unsigned_signed_opt range_opt list_of_identifiers ';' { svector*tmp = pform_make_task_ports(NetNet::PINPUT, - IVL_VT_NO_TYPE, $3, - $4, $5, + $2 ? IVL_VT_LOGIC : + IVL_VT_NO_TYPE, + $3, $4, $5, @1.text, @1.first_line); $$ = tmp; } | K_output reg_opt unsigned_signed_opt range_opt list_of_identifiers ';' { svector*tmp = pform_make_task_ports(NetNet::POUTPUT, - IVL_VT_LOGIC, $3, - $4, $5, + $2 ? IVL_VT_LOGIC : + IVL_VT_NO_TYPE, + $3, $4, $5, @1.text, @1.first_line); $$ = tmp; } | K_inout reg_opt unsigned_signed_opt range_opt list_of_identifiers ';' { svector*tmp = pform_make_task_ports(NetNet::PINOUT, - IVL_VT_LOGIC, $3, - $4, $5, + $2 ? IVL_VT_LOGIC : + IVL_VT_NO_TYPE, + $3, $4, $5, @1.text, @1.first_line); $$ = tmp; } @@ -4323,7 +4325,7 @@ task_port_item svector*tmp = pform_make_task_ports(NetNet::PINPUT, IVL_VT_LOGIC, true, range_stub, $3, - @1.text, @1.first_line); + @1.text, @1.first_line, true); $$ = tmp; } | K_output K_integer list_of_identifiers ';' @@ -4331,7 +4333,7 @@ task_port_item svector*tmp = pform_make_task_ports(NetNet::POUTPUT, IVL_VT_LOGIC, true, range_stub, $3, - @1.text, @1.first_line); + @1.text, @1.first_line, true); $$ = tmp; } | K_inout K_integer list_of_identifiers ';' @@ -4339,7 +4341,7 @@ task_port_item svector*tmp = pform_make_task_ports(NetNet::PINOUT, IVL_VT_LOGIC, true, range_stub, $3, - @1.text, @1.first_line); + @1.text, @1.first_line, true); $$ = tmp; } @@ -4472,7 +4474,7 @@ task_port_decl IVL_VT_LOGIC, true, range_stub, list_from_identifier($3), - @1.text, @1.first_line); + @1.text, @1.first_line, true); $$ = tmp; } | K_output K_integer IDENTIFIER @@ -4486,7 +4488,7 @@ task_port_decl IVL_VT_LOGIC, true, range_stub, list_from_identifier($3), - @1.text, @1.first_line); + @1.text, @1.first_line, true); $$ = tmp; } | K_inout K_integer IDENTIFIER @@ -4500,7 +4502,7 @@ task_port_decl IVL_VT_LOGIC, true, range_stub, list_from_identifier($3), - @1.text, @1.first_line); + @1.text, @1.first_line, true); $$ = tmp; } diff --git a/pform.cc b/pform.cc index 57f753c76..5e4ea3c23 100644 --- a/pform.cc +++ b/pform.cc @@ -2066,7 +2066,8 @@ svector*pform_make_task_ports(NetNet::PortType pt, list*range, list*names, const char* file, - unsigned lineno) + unsigned lineno, + bool isint) { assert(names); svector*res = new svector(0); @@ -2087,6 +2088,7 @@ svector*pform_make_task_ports(NetNet::PortType pt, } curw->set_signed(signed_flag); + if (isint) assert(curw->set_wire_type(NetNet::INTEGER)); /* If there is a range involved, it needs to be set. */ if (range) { diff --git a/pform.h b/pform.h index 966b5fe8d..fff1d1b43 100644 --- a/pform.h +++ b/pform.h @@ -1,7 +1,7 @@ #ifndef __pform_H #define __pform_H /* - * Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2011 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -369,7 +369,8 @@ extern svector*pform_make_task_ports(NetNet::PortType pt, list*range, list*names, const char* file, - unsigned lineno); + unsigned lineno, + bool isint = false); /*