Comments (7)
Verilog parameters must be contained within a module. I had a quick look into the SystemVerilog spec and it does not look like they allow parameters outside of modules either...
But maybe I'm wrong.. What makes you believe that verilog parameters outside a module are allowed in Verilog? What would the intended behavior of that be?
Closing the issue now. I'll reopen it if it turns out there is more to it..
from yosys.
Well, both Vivado and Verilator supports it, so I just naively assumed that it is valid. Of course, this does not mean that it is in the standard.
from yosys.
both Vivado and Verilator supports it
interesting. Icarus Verilog, GPLCver, Veriwell, Verific, and Synplify Pro produce errors for this. Riviera-PRO and VCS seem to accept parameters outside of modules.
Looking at the IEEE 1800-2012 Std. document again it looks like parameter
declarations (as well as localparam
declarations) are package items and package items can be used in the global context. So I have now added support for that in commit ba4cce9.
Thanks for bringing this to my attention.
from yosys.
Excellent - then I don't need to change my code right away, thanks!
From what you say, it sounds like it is left undefined in the standard, so probably I should get rid of global parameter definitions.
Thanks again.
from yosys.
it sounds like it is left undefined in the standard
Well, it's definitely not part of Verilog 2005. But it is part of SystemVerilog 2012 and seems to be well-defined.
However, I wonder if you are using parameter
when in fact you'd only need localparam
. (parameter
can be overwritten at module instantiation, localparam
is just a name for a constant value.)
from yosys.
Well, it's definitely not part of Verilog 2005. But it is part of SystemVerilog 2012 and seems to be well-defined.
Weird I did not think that SystemVerilog for Vivado was enabled by default.
Probably I could use localparam
as well. I am fairly inexperienced with Verilog and as I've picked it up quite quickly, I probably have developed one or more bad habits along the way. Basically what I am doing is following: I have a unit with a UART serial interface with N-bit instructions. As I continue to extend the code, I add more and more instructions which in turn means number of bits to describe an instruction increases - to avoid spreading instruction codes and instruction format all over the code, I have nicely gathered this in one file. Feel free to come with suggestions on how you would go about this.
from yosys.
Just a last comment on this one:
Vivado seems to be using SystemVerilog 1800-2009 and for Verilator the code compiles with SV 1800-2005, but not with 1364-2005. Verilator does at no point complain about the global scope parameters, but only other things.
from yosys.
Related Issues (20)
- system verilog "import" command not recognized (ERROR: syntax error, unexpected TOK_ID) HOT 3
- check-git-abc in Makefile for the first compile time HOT 4
- `count_id(cell->name) == 0` failure HOT 1
- IDES4_MEM gowin module is missing HOT 2
- Feature Request: Add Support for Input Filelist Option HOT 8
- CologneChip synthesis fails silently (simulation discrepancies) HOT 2
- Yosys Synthesis Error: Hash Table Exceeded Maximum Size HOT 8
- support error for Aggregate Initialization and Replication HOT 1
- Unable to code FSM into binary format HOT 2
- Can't build from 0.42 tarball HOT 1
- ABC: execution of command failed return code 139. HOT 3
- Variable Part Selects HOT 5
- ABC: execution of command failed return code 137. HOT 5
- Yosys Optimization Error: Optimization Stuck in PEEPOPT Pass HOT 2
- Yosys Optimization Issue: Process Stuck at OPT_CLEAN Pass HOT 1
- Build issue with abc submodule HOT 2
- Optimization Sequence Induces Synthesis Errors Leading to Simulation Inconsistencies HOT 10
- Optimization Sequence Leads to Functionally Incorrect Synthesis Output in Yosys HOT 1
- Custom Yosys Passes Result in Faulty Synthesis and Simulation Errors HOT 1
- Any plans to add CDC linting? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yosys.