forked from steveicarus/iverilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework handling of timescales in parser.
This implements and enforces the full set of rules for determining timescales in SystemVerilog. The previous relaxation of the rules that allowed timescales to be redefined within the compilation unit scope has been removed. Time unit and precision redeclarations are now recognised after a nested module declaration.
- Loading branch information
1 parent
9382d22
commit fd807a7
Showing
12 changed files
with
330 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 1998-2016 Stephen Williams ([email protected]) | ||
* Copyright (c) 1998-2017 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -35,7 +35,6 @@ Module::Module(LexicalScope*parent, perm_string n) | |
is_interface = false; | ||
program_block = false; | ||
uc_drive = UCD_NONE; | ||
timescale_warn_done = false; | ||
} | ||
|
||
Module::~Module() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#ifndef IVL_Module_H | ||
#define IVL_Module_H | ||
/* | ||
* Copyright (c) 1998-2016 Stephen Williams ([email protected]) | ||
* Copyright (c) 1998-2017 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -121,8 +121,6 @@ class Module : public PScopeExtra, public LineInfo { | |
|
||
map<perm_string,PExpr*> attributes; | ||
|
||
bool timescale_warn_done; | ||
|
||
/* The module has a list of generate schemes that appear in | ||
the module definition. These are used at elaboration time. */ | ||
list<PGenerate*> generate_schemes; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2008,2016 Stephen Williams ([email protected]) | ||
* Copyright (c) 2008-2017 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -38,7 +38,8 @@ PScope::PScope(perm_string n, LexicalScope*parent) | |
{ | ||
time_unit = 0; | ||
time_precision = 0; | ||
time_from_timescale = false; | ||
time_unit_is_default = true; | ||
time_prec_is_default = true; | ||
} | ||
|
||
PScope::~PScope() | ||
|
@@ -51,6 +52,8 @@ PScope::~PScope() | |
PScopeExtra::PScopeExtra(perm_string n, LexicalScope*parent) | ||
: PScope(n, parent) | ||
{ | ||
time_unit_is_local = false; | ||
time_prec_is_local = false; | ||
} | ||
|
||
PScopeExtra::~PScopeExtra() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#ifndef IVL_PScope_H | ||
#define IVL_PScope_H | ||
/* | ||
* Copyright (c) 2008-2016 Stephen Williams ([email protected]) | ||
* Copyright (c) 2008-2017 Stephen Williams ([email protected]) | ||
* | ||
* This source code is free software; you can redistribute it | ||
* and/or modify it in source code form under the terms of the GNU | ||
|
@@ -164,11 +164,18 @@ class PScope : public LexicalScope { | |
|
||
perm_string pscope_name() const { return name_; } | ||
|
||
/* These are the timescale for this scope. The default is | ||
/* These are the timescale for this scope. The value is | ||
set by the `timescale directive or, in SystemVerilog, | ||
by timeunit and timeprecision statements. */ | ||
int time_unit, time_precision; | ||
bool time_from_timescale; | ||
|
||
/* Flags used to support warnings about timescales. */ | ||
bool time_unit_is_default; | ||
bool time_prec_is_default; | ||
|
||
bool has_explicit_timescale() const { | ||
return !(time_unit_is_default || time_prec_is_default); | ||
} | ||
|
||
protected: | ||
bool elaborate_sig_wires_(Design*des, NetScope*scope) const; | ||
|
@@ -199,6 +206,10 @@ class PScopeExtra : public PScope { | |
elaboration to choose an elaboration order. */ | ||
std::vector<PClass*> classes_lexical; | ||
|
||
/* Flags used to support warnings about timescales. */ | ||
bool time_unit_is_local; | ||
bool time_prec_is_local; | ||
|
||
protected: | ||
void dump_classes_(ostream&out, unsigned indent) const; | ||
void dump_tasks_(ostream&out, unsigned indent) const; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.