Drive strengths for continuous assignments.

This commit is contained in:
steve 2002-01-12 04:03:39 +00:00
parent c09a148cd9
commit 361d4f2147
4 changed files with 73 additions and 32 deletions

28
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: parse.y,v 1.143 2001/12/31 05:23:13 steve Exp $"
#ident "$Id: parse.y,v 1.144 2002/01/12 04:03:39 steve Exp $"
#endif
# include "config.h"
@ -31,12 +31,11 @@ extern void lex_start_table();
extern void lex_end_table();
/*
* These are the strengths to use for net declaration
* assignments. They are stored here so that scope that contains the
* net_decl_assigns can change them during specific statements.
* These are some common strength pairs that are used as defaults when
* the user is not otherwise specific.
*/
static struct str_pair_t decl_strength = { PGate::STRONG, PGate::STRONG };
static struct str_pair_t pull_strength = { PGate::PULL, PGate::PULL };
const static struct str_pair_t pull_strength = { PGate::PULL, PGate::PULL };
const static struct str_pair_t str_strength = { PGate::STRONG, PGate::STRONG };
%}
%union {
@ -1204,16 +1203,11 @@ module_item
}
}
| net_type range_delay net_decl_assigns ';'
{ pform_makewire(@1, $2.range, $2.delay, $3, $1);
{ pform_makewire(@1, $2.range, $2.delay, str_strength,
$3, $1);
}
| net_type drive_strength { decl_strength = $2;} net_decl_assigns ';'
{ pform_makewire(@1, 0, 0, $4, $1);
/* The strengths are handled in the
net_decl_assigns using the decl_strength that I
set in the rule. Right here, just restore the
defaults for other rules. */
decl_strength.str0 = PGate::STRONG;
decl_strength.str1 = PGate::STRONG;
| net_type drive_strength net_decl_assigns ';'
{ pform_makewire(@1, 0, 0, $2, $3, $1);
}
| K_trireg charge_strength_opt range_delay list_of_variables ';'
{ yyerror(@1, "sorry: trireg nets not supported.");
@ -1241,11 +1235,11 @@ module_item
three-value delay. These rules handle the different cases. */
| gatetype gate_instance_list ';'
{ pform_makegates($1, decl_strength, 0, $2);
{ pform_makegates($1, str_strength, 0, $2);
}
| gatetype delay3 gate_instance_list ';'
{ pform_makegates($1, decl_strength, $2, $3);
{ pform_makegates($1, str_strength, $2, $3);
}
| gatetype drive_strength gate_instance_list ';'

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.cc,v 1.87 2001/12/07 05:03:13 steve Exp $"
#ident "$Id: pform.cc,v 1.88 2002/01/12 04:03:39 steve Exp $"
#endif
# include "config.h"
@ -769,16 +769,13 @@ void pform_makewire(const vlltype&li,
void pform_makewire(const vlltype&li,
svector<PExpr*>*range,
svector<PExpr*>*delay,
str_pair_t str,
net_decl_assign_t*decls,
NetNet::Type type)
{
net_decl_assign_t*first = decls->next;
decls->next = 0;
struct str_pair_t str;
str.str0 = PGate::STRONG;
str.str1 = PGate::STRONG;
while (first) {
net_decl_assign_t*next = first->next;
@ -1158,6 +1155,9 @@ int pform_parse(const char*path, FILE*file)
/*
* $Log: pform.cc,v $
* Revision 1.88 2002/01/12 04:03:39 steve
* Drive strengths for continuous assignments.
*
* Revision 1.87 2001/12/07 05:03:13 steve
* Support integer for function return value.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: pform.h,v 1.54 2001/12/07 05:03:13 steve Exp $"
#ident "$Id: pform.h,v 1.55 2002/01/12 04:03:39 steve Exp $"
#endif
# include "netlist.h"
@ -147,6 +147,7 @@ extern void pform_makewire(const struct vlltype&li,
extern void pform_makewire(const struct vlltype&li,
svector<PExpr*>*range,
svector<PExpr*>*delay,
str_pair_t str,
net_decl_assign_t*assign_list,
NetNet::Type type);
extern void pform_make_reginit(const struct vlltype&li,
@ -218,6 +219,9 @@ extern void pform_dump(ostream&out, Module*mod);
/*
* $Log: pform.h,v $
* Revision 1.55 2002/01/12 04:03:39 steve
* Drive strengths for continuous assignments.
*
* Revision 1.54 2001/12/07 05:03:13 steve
* Support integer for function return value.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvp_scope.c,v 1.62 2002/01/06 03:15:43 steve Exp $"
#ident "$Id: vvp_scope.c,v 1.63 2002/01/12 04:03:40 steve Exp $"
#endif
# include "vvp_priv.h"
@ -151,6 +151,27 @@ ivl_signal_type_t signal_type_of_nexus(ivl_nexus_t nex)
return out;
}
ivl_nexus_ptr_t ivl_logic_pin_ptr(ivl_net_logic_t net, unsigned pin)
{
ivl_nexus_t nex = ivl_logic_pin(net, pin);
unsigned idx;
for (idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) {
ivl_nexus_ptr_t ptr = ivl_nexus_ptr(nex, idx);
ivl_net_logic_t tmp = ivl_nexus_ptr_log(ptr);
if (tmp == 0)
continue;
if (tmp != net)
continue;
if (ivl_nexus_ptr_pin(ptr) != pin)
continue;
return ptr;
}
assert(0);
return 0;
}
const char*drive_string(ivl_drive_t drive)
{
switch (drive) {
@ -221,10 +242,16 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
ivl_lpm_t lpm;
lptr = ivl_nexus_ptr_log(nptr);
if (lptr && (ivl_logic_type(lptr) == IVL_LO_BUFZ) &&
(nptr_pin == 0)) {
return draw_net_input(ivl_logic_pin(lptr, 1));
}
if (lptr && (ivl_logic_type(lptr) == IVL_LO_BUFZ) && (nptr_pin == 0))
do {
if (ivl_nexus_ptr_drive0(nptr) != IVL_DR_STRONG)
break;
if (ivl_nexus_ptr_drive1(nptr) != IVL_DR_STRONG)
break;
return draw_net_input(ivl_logic_pin(lptr, 1));
} while(0);
if (lptr && (ivl_logic_type(lptr) == IVL_LO_PULLDOWN)) {
return "C<pu0>";
@ -645,10 +672,23 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
draw_udp_in_scope(lptr);
return;
case IVL_LO_BUFZ:
/* Skip BUFZ objects. Things that have a bufz as input
will use the input to bufz instead. */
return;
case IVL_LO_BUFZ: {
/* Draw bufz objects, but only if the output drive
is different from the input. */
ivl_nexus_ptr_t nptr = ivl_logic_pin_ptr(lptr,0);
ivl_drive_t dr0 = ivl_nexus_ptr_drive0(nptr);
ivl_drive_t dr1 = ivl_nexus_ptr_drive1(nptr);
ltype = "BUFZ";
if (dr0 != IVL_DR_STRONG)
break;
if (dr1 != IVL_DR_STRONG)
break;
return;
}
case IVL_LO_PULLDOWN:
case IVL_LO_PULLUP:
@ -1364,6 +1404,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
/*
* $Log: vvp_scope.c,v $
* Revision 1.63 2002/01/12 04:03:40 steve
* Drive strengths for continuous assignments.
*
* Revision 1.62 2002/01/06 03:15:43 steve
* Constant values have drive strengths.
*