Support nmos and pmos, bug488.

This commit is contained in:
Wilson Snyder 2012-04-23 20:13:07 -04:00
parent ed5bc1e69c
commit ffbd595d88
7 changed files with 68 additions and 4 deletions

View File

@ -11,6 +11,8 @@ indicates the contributor was also the author of the fix; Thanks!
*** Support tri0 and tri1, bug462. [Alex Solomatnikov] *** Support tri0 and tri1, bug462. [Alex Solomatnikov]
*** Support nmos and pmos, bug488. [Alex Solomatnikov]
*** Fix generate operators not short circuiting, bug413. [by Jeremy Bennett] *** Fix generate operators not short circuiting, bug413. [by Jeremy Bennett]

View File

@ -2239,8 +2239,8 @@ practice, just setting all variables to one at startup finds most problems.
=head2 Tri/Inout =head2 Tri/Inout
Verilator converts some simple tristate structures into two state. Pullup, Verilator converts some simple tristate structures into two state. Pullup,
pulldown, bufif0, bufif1, notif0, notif1, tri0 and tri1 are also supported. pulldown, bufif0, bufif1, notif0, notif1, pmos, nmos, tri0 and tri1 are
Simple comparisons with === 1'bz are also supported. also supported. Simple comparisons with === 1'bz are also supported.
An assignment of the form: An assignment of the form:

View File

@ -2705,10 +2705,10 @@ gateDecl<nodep>:
| yXNOR delayE gateXnorList ';' { $$ = $3; } | yXNOR delayE gateXnorList ';' { $$ = $3; }
| yPULLUP delayE gatePullupList ';' { $$ = $3; } | yPULLUP delayE gatePullupList ';' { $$ = $3; }
| yPULLDOWN delayE gatePulldownList ';' { $$ = $3; } | yPULLDOWN delayE gatePulldownList ';' { $$ = $3; }
| yNMOS delayE gateBufif1List ';' { $$ = $3; } // ~=bufif1, as don't have strengths yet
| yPMOS delayE gateBufif0List ';' { $$ = $3; } // ~=bufif0, as don't have strengths yet
// //
| yTRAN delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"tran"); } // Unsupported | yTRAN delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"tran"); } // Unsupported
| yNMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"nmos"); } // Unsupported
| yPMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"pmos"); } // Unsupported
| yRCMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"rcmos"); } // Unsupported | yRCMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"rcmos"); } // Unsupported
| yCMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"cmos"); } // Unsupported | yCMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"cmos"); } // Unsupported
| yRNMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"rmos"); } // Unsupported | yRNMOS delayE gateUnsupList ';' { $$ = $3; GATEUNSUP($3,"rmos"); } // Unsupported

View File

@ -13,6 +13,10 @@
# include "Vt_tri_gate_notif0.h" # include "Vt_tri_gate_notif0.h"
#elif defined(T_NOTIF1) #elif defined(T_NOTIF1)
# include "Vt_tri_gate_notif1.h" # include "Vt_tri_gate_notif1.h"
#elif defined(T_PMOS)
# include "Vt_tri_gate_pmos.h"
#elif defined(T_NMOS)
# include "Vt_tri_gate_nmos.h"
#else #else
# error "Unknown test" # error "Unknown test"
#endif #endif

View File

@ -26,6 +26,10 @@ module tbuf (input A, input OE, output Z);
notif0 (Z, !A, !OE); notif0 (Z, !A, !OE);
`elsif T_NOTIF1 `elsif T_NOTIF1
notif1 (Z, !A, OE); notif1 (Z, !A, OE);
`elsif T_PMOS
pmos (Z, A, !OE);
`elsif T_NMOS
nmos (Z, A, OE);
`elsif T_COND `elsif T_COND
assign Z = (OE) ? A : 1'bz; assign Z = (OE) ? A : 1'bz;
`else `else

View File

@ -0,0 +1,27 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003-2009 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
top_filename("t/t_tri_gate.v");
$Self->{vlt} or $Self->skip("Verilator only test");
compile (
make_top_shell => 0,
make_main => 0,
v_flags2 => ['+define+T_NMOS',],
make_flags => 'CPPFLAGS_ADD=-DT_NMOS',
verilator_flags2 => ["--exe $Self->{t_dir}/t_tri_gate.cpp"],
);
execute (
check_finished=>1,
);
ok(1);
1;

View File

@ -0,0 +1,27 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003-2009 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
top_filename("t/t_tri_gate.v");
$Self->{vlt} or $Self->skip("Verilator only test");
compile (
make_top_shell => 0,
make_main => 0,
v_flags2 => ['+define+T_PMOS',],
make_flags => 'CPPFLAGS_ADD=-DT_PMOS',
verilator_flags2 => ["--exe $Self->{t_dir}/t_tri_gate.cpp"],
);
execute (
check_finished=>1,
);
ok(1);
1;