v0.9: Fix some bugs in task integer/real arguments.
This patch fixes the following problem in the compiler:
An integer task argument should be marked as an integer port.
An implicit register can be converted to either a reg or an integer.
An old style task port should default to <no type> unless reg or some
other type is provided. ANSI style is always defined. For example:
input ri;
output ro;
inout rio;
real ri, ro, rio;
should define all three task ports to be of type real.
This commit is contained in:
parent
d08d7d8858
commit
3b89043f68
12
PWire.cc
12
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) {
|
||||
|
|
|
|||
36
parse.y
36
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 <flag> from_exclude
|
||||
%type <number> number
|
||||
%type <flag> signed_opt udp_reg_opt edge_operator automatic_opt
|
||||
%type <flag> signed_opt reg_opt udp_reg_opt edge_operator automatic_opt
|
||||
%type <drive> drive_strength drive_strength_opt dr_strength0 dr_strength1
|
||||
%type <letter> udp_input_sym udp_output_sym
|
||||
%type <text> 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<PWire*>*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<PWire*>*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<PWire*>*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;
|
||||
}
|
||||
|
||||
|
|
|
|||
6
pform.cc
6
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<PWire*>*pform_make_task_ports(NetNet::PortType pt,
|
|||
svector<PExpr*>*range,
|
||||
list<perm_string>*names,
|
||||
const char* file,
|
||||
unsigned lineno)
|
||||
unsigned lineno,
|
||||
bool isint)
|
||||
{
|
||||
assert(names);
|
||||
svector<PWire*>*res = new svector<PWire*>(0);
|
||||
|
|
@ -1761,6 +1762,7 @@ svector<PWire*>*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)
|
||||
|
|
|
|||
5
pform.h
5
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<PWire*>*pform_make_task_ports(NetNet::PortType pt,
|
|||
svector<PExpr*>*range,
|
||||
list<perm_string>*names,
|
||||
const char* file,
|
||||
unsigned lineno);
|
||||
unsigned lineno,
|
||||
bool isint = false);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue