diff --git a/PWire.cc b/PWire.cc index 911c2d537..90f984143 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 6a0b6d03d..d03f804f4 100644 --- a/parse.y +++ b/parse.y @@ -1,7 +1,7 @@ %{ /* - * 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 @@ -289,7 +289,7 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2) %type from_exclude %type number -%type signed_opt udp_reg_opt edge_operator automatic_opt +%type signed_opt reg_opt udp_reg_opt edge_operator automatic_opt %type drive_strength drive_strength_opt dr_strength0 dr_strength1 %type udp_input_sym udp_output_sym %type udp_input_list udp_sequ_entry udp_comb_entry @@ -3950,33 +3950,35 @@ task_item ; reg_opt - : K_reg - | + : K_reg { $$ = true; } + | { $$ = false; } ; task_port_item - : K_input reg_opt 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 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 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; } @@ -3996,7 +3998,7 @@ task_port_item = 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 ';' @@ -4011,7 +4013,7 @@ task_port_item = 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 ';' @@ -4026,7 +4028,7 @@ task_port_item = 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; } @@ -4184,7 +4186,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 @@ -4205,7 +4207,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 @@ -4226,7 +4228,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 294520db4..163b4ba3b 100644 --- a/pform.cc +++ b/pform.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2009 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 @@ -1740,7 +1740,8 @@ svector*pform_make_task_ports(NetNet::PortType pt, svector*range, list*names, const char* file, - unsigned lineno) + unsigned lineno, + bool isint) { assert(names); svector*res = new svector(0); @@ -1761,6 +1762,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 2e35c51a5..c61c2f142 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 @@ -356,7 +356,8 @@ extern svector*pform_make_task_ports(NetNet::PortType pt, svector*range, list*names, const char* file, - unsigned lineno); + unsigned lineno, + bool isint = false); /*