Add support for rtran switches in vvp.
This commit is contained in:
parent
36eef5154f
commit
5cfb7d68ae
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008-2016 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2008-2018 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
|
||||
|
|
@ -73,6 +73,15 @@ void draw_switch_in_scope(ivl_switch_t sw)
|
|||
}
|
||||
|
||||
switch (ivl_switch_type(sw)) {
|
||||
case IVL_SW_RTRAN:
|
||||
fprintf(vvp_out, " .rtran");
|
||||
break;
|
||||
case IVL_SW_RTRANIF0:
|
||||
fprintf(vvp_out, " .rtranif0");
|
||||
break;
|
||||
case IVL_SW_RTRANIF1:
|
||||
fprintf(vvp_out, " .rtranif1");
|
||||
break;
|
||||
case IVL_SW_TRAN:
|
||||
fprintf(vvp_out, " .tran");
|
||||
break;
|
||||
|
|
@ -88,8 +97,7 @@ void draw_switch_in_scope(ivl_switch_t sw)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s:%u: tgt-vvp sorry: resistive switch modeling "
|
||||
"is not currently supported.\n",
|
||||
fprintf(stderr, "%s:%u: tgt-vvp error: unrecognised switch type.\n",
|
||||
ivl_switch_file(sw), ivl_switch_lineno(sw));
|
||||
vvp_errors += 1;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ extern void compile_island_cleanup(void);
|
|||
|
||||
extern void compile_island_tran(char*label);
|
||||
extern void compile_island_tranif(int sense, char*island,
|
||||
char*ba, char*bb, char*src);
|
||||
char*ba, char*bb, char*src, bool resistive);
|
||||
extern void compile_island_tranvp(char*island, char*ba, char*bb,
|
||||
unsigned width, unsigned part, unsigned off);
|
||||
|
||||
|
|
|
|||
|
|
@ -401,7 +401,8 @@ void compile_island_tran(char*label)
|
|||
compile_island_base(label, use_island);
|
||||
}
|
||||
|
||||
void compile_island_tranif(int sense, char*island, char*pa, char*pb, char*pe)
|
||||
void compile_island_tranif(int sense, char*island, char*pa, char*pb, char*pe,
|
||||
bool resistive)
|
||||
{
|
||||
vvp_island*use_island = compile_find_island(island);
|
||||
assert(use_island);
|
||||
|
|
@ -418,7 +419,7 @@ void compile_island_tranif(int sense, char*island, char*pa, char*pb, char*pe)
|
|||
vvp_island_branch_tran*br = new vvp_island_branch_tran(en,
|
||||
sense ? true :
|
||||
false,
|
||||
0, 0, 0, false);
|
||||
0, 0, 0, resistive);
|
||||
|
||||
use_island->add_branch(br, pa, pb);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2018 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
|
||||
|
|
@ -196,6 +196,9 @@ static char* strdupnew(char const *str)
|
|||
".reduce/xnor" { return K_REDUCE_XNOR; }
|
||||
".repeat" { return K_REPEAT; }
|
||||
".resolv" { return K_RESOLV; }
|
||||
".rtran" { return K_RTRAN; }
|
||||
".rtranif0" { return K_RTRANIF0; }
|
||||
".rtranif1" { return K_RTRANIF1; }
|
||||
".scope" { return K_SCOPE; }
|
||||
".sfunc" { return K_SFUNC; }
|
||||
".sfunc/e" { return K_SFUNC_E; }
|
||||
|
|
|
|||
20
vvp/parse.y
20
vvp/parse.y
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2018 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
|
||||
|
|
@ -93,7 +93,8 @@ static struct __vpiModPath*modpath_dst = 0;
|
|||
%token K_PARAM_STR K_PARAM_L K_PARAM_REAL K_PART K_PART_PV
|
||||
%token K_PART_V K_PART_V_S K_PORT K_PORT_INFO K_PV K_REDUCE_AND K_REDUCE_OR K_REDUCE_XOR
|
||||
%token K_REDUCE_NAND K_REDUCE_NOR K_REDUCE_XNOR K_REPEAT
|
||||
%token K_RESOLV K_SCOPE K_SFUNC K_SFUNC_E K_SHIFTL K_SHIFTR K_SHIFTRS
|
||||
%token K_RESOLV K_RTRAN K_RTRANIF0 K_RTRANIF1
|
||||
%token K_SCOPE K_SFUNC K_SFUNC_E K_SHIFTL K_SHIFTR K_SHIFTRS
|
||||
%token K_SUBSTITUTE
|
||||
%token K_THREAD K_TIMESCALE K_TRAN K_TRANIF0 K_TRANIF1 K_TRANVP
|
||||
%token K_UFUNC_REAL K_UFUNC_VEC4 K_UFUNC_E K_UDP K_UDP_C K_UDP_S
|
||||
|
|
@ -870,14 +871,23 @@ statement
|
|||
| T_LABEL K_EXPORT T_SYMBOL ';'
|
||||
{ compile_island_export($1, $3); }
|
||||
|
||||
| K_RTRAN T_SYMBOL ',' T_SYMBOL T_SYMBOL ';'
|
||||
{ compile_island_tranif(0, $2, $4, $5, 0, 1); }
|
||||
|
||||
| K_RTRANIF0 T_SYMBOL ',' T_SYMBOL T_SYMBOL ',' T_SYMBOL ';'
|
||||
{ compile_island_tranif(0, $2, $4, $5, $7, 1); }
|
||||
|
||||
| K_RTRANIF1 T_SYMBOL ',' T_SYMBOL T_SYMBOL ',' T_SYMBOL ';'
|
||||
{ compile_island_tranif(1, $2, $4, $5, $7, 1); }
|
||||
|
||||
| K_TRAN T_SYMBOL ',' T_SYMBOL T_SYMBOL ';'
|
||||
{ compile_island_tranif(0, $2, $4, $5, 0); }
|
||||
{ compile_island_tranif(0, $2, $4, $5, 0, 0); }
|
||||
|
||||
| K_TRANIF0 T_SYMBOL ',' T_SYMBOL T_SYMBOL ',' T_SYMBOL ';'
|
||||
{ compile_island_tranif(0, $2, $4, $5, $7); }
|
||||
{ compile_island_tranif(0, $2, $4, $5, $7, 0); }
|
||||
|
||||
| K_TRANIF1 T_SYMBOL ',' T_SYMBOL T_SYMBOL ',' T_SYMBOL ';'
|
||||
{ compile_island_tranif(1, $2, $4, $5, $7); }
|
||||
{ compile_island_tranif(1, $2, $4, $5, $7, 0); }
|
||||
|
||||
| K_TRANVP T_NUMBER T_NUMBER T_NUMBER ',' T_SYMBOL ',' T_SYMBOL T_SYMBOL ';'
|
||||
{ compile_island_tranvp($6, $8, $9, $2, $3, $4); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue