Support --bbox-unsup parsing of parameterized classes

This commit is contained in:
Wilson Snyder 2020-06-06 10:06:32 -04:00
parent 7067afde5d
commit f083805ab5
4 changed files with 75 additions and 2 deletions

View File

@ -29,6 +29,7 @@
#include <cstdlib>
#include <cstdarg>
#include <stack>
#define YYERROR_VERBOSE 1
#define YYINITDEPTH 10000 // Older bisons ignore YYMAXDEPTH
@ -67,12 +68,14 @@ public:
AstNodeDType* m_memDTypep; // Pointer to data type for next member declaration
AstNodeModule* m_modp; // Last module for timeunits
bool m_pinAnsi; // In ANSI port list
int m_pinNum; // Pin number currently parsing
FileLine* m_instModuleFl; // Fileline of module referenced for instantiations
string m_instModule; // Name of module referenced for instantiations
AstPin* m_instParamp; // Parameters for instantiations
bool m_tracingParse; // Tracing disable for parser
int m_pinNum; // Pin number currently parsing
std::stack<int> m_pinStack; // Queue of pin numbers being parsed
static int s_modTypeImpNum; // Implicit type number, incremented each module
// CONSTRUCTORS
@ -141,6 +144,15 @@ public:
if (m_varDTypep) VL_DO_CLEAR(m_varDTypep->deleteTree(), m_varDTypep = NULL);
m_varDTypep = dtypep;
}
void pinPush() {
m_pinStack.push(m_pinNum);
m_pinNum = 1;
}
void pinPop(FileLine* fl) {
if (VL_UNCOVERABLE(m_pinStack.empty())) { fl->v3fatalSrc("Underflow of pin stack"); }
m_pinNum = m_pinStack.top();
m_pinStack.pop();
}
AstPackage* unitPackage(FileLine* fl) {
// Find one made earlier?
VSymEnt* symp = SYMP->symRootp()->findIdFlat(AstPackage::dollarUnitName());
@ -2667,7 +2679,7 @@ instRange<rangep>:
;
cellparamList<pinp>:
{VARRESET_LIST(UNKNOWN);} cellparamItList { $$ = $2; VARRESET_NONLIST(UNKNOWN); }
{ GRAMMARP->pinPush(); } cellparamItList { $$ = $2; GRAMMARP->pinPop(CRELINE()); }
;
cellpinList<pinp>:

View File

@ -0,0 +1,10 @@
%Error: t/t_class_vparam_unsup.v:12:1: Unsupported: virtual classes
12 | virtual class vclass #(type CTYPE_t = arg_class_t);
| ^~~~~~~
%Error: t/t_class_vparam_unsup.v:13:58: Unsupported: Parameter classes
13 | pure virtual function void funcname(paramed_class_t #(CTYPE_t) v);
| ^~~~~~~
%Error: t/t_class_vparam_unsup.v:13:4: Unsupported: pure virtual class method
13 | pure virtual function void funcname(paramed_class_t #(CTYPE_t) v);
| ^~~~
%Error: Exiting due to

View File

@ -0,0 +1,19 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 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.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
lint(
fails => $Self->{vlt_all},
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,32 @@
// DESCRIPTION: Verilator: Verilog Test module for SystemVerilog 'alias'
//
// Simple bi-directional alias test.
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
typedef class paramed_class_t;
typedef class arg_class_t;
virtual class vclass #(type CTYPE_t = arg_class_t);
pure virtual function void funcname(paramed_class_t #(CTYPE_t) v);
endclass
class paramed_class_t #(type TYPE=int);
endclass
class arg_class_t;
endclass
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
always @ (posedge clk) begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule