Comments (4)
I’d suggest to enter the code like the following. It should be functionally equivalent but points out better the intent.
(* parallel case *)
case(1) // synopsys parallel_case
((pc_state & `PcState_defautEncoding_Idle) == `PcState_defaultEncoding_Idle): begin
Also this would allow the code to be used for other *hot encodings as well, e.g. two-hot.
However, the parallel_case
tags should only be applied if really all cases have been decoded. Is SpinalHDL already capable of detecting this property in a water-proof way?
from spinalhdl.
@typingArtist
So you have access to the whole AST durring the Verilog generation.
There is where the switch cases statements is emited :
The is isPure is calculated to be true if only literals are used in the SpinalHDL 'is' statements, as Verilog doesn't support case statements with non literal cases.
So the generation of switch statement with only literal stuff is there
@typingArtist and @tomverbeure
What happend if you throw some
(* parallel case *)
case(1) // synopsys parallel_case
((pc_state & `PcState_defautEncoding_Idle) == `PcState_defaultEncoding_Idle): begin
code into non synposys / parrallel cases capable tools ? is that still legal verilog ?
from spinalhdl.
However, the parallel_case tags should only be applied if really all cases have been decoded.
I believe that's only true for full_case, but not for parallel_case. My rule of thumb is to never ever use full_case. It's too dangerous. For parallel_case, the simply rule of them is the one listed above: if you know for sure that the input is one-hot, then you're good, even if you don't cover all the options.
code into non synposys / parrallel cases capable tools ? is that still legal verilog ?
Tools that don't implement the parallel case
will implement a priority encoder instead of a flat encoder. But it will functionally still be totally fine. It's legal Verilog.
Tom
from spinalhdl.
@typingArtist
Your patch is great! As expected, the clock speed of my design went up, and number of gates went down.
I suggest 2 fixed:
-
// synopsys parallel_case
->// synthesis parallel_case
I'm old school, but even if some tools still don't support
(* parallel_case *)
, they all supportsynthesis
instead ofsynopsys
. -
Either keep the
(* parallel_case *)
attribute, or provide an option to use one or the other or both.
Tom
from spinalhdl.
Related Issues (20)
- How to understand the Simulated behavior in SpinalHDL? HOT 4
- spinal.lib.misc.pipeline refractoring
- SpinalConfig.generate does not work as expected When define two modules with implicit parameter in "generate" func HOT 7
- Axi4Stream: userWidth tied to dataWidth HOT 5
- Implicit parity signal in Bundle, freeze, and signalCache HOT 7
- Arbitrary data bundle type for Axi4Stream HOT 8
- Blackbox Verilog sources are not included in formal verification
- Vec as packed array in io HOT 9
- Issues with verilator 5 HOT 2
- Documentation / example usage for `Axi4ReadOnlyMasterAgent` and `Axi4WriteOnlyMasterAgent` HOT 5
- Signals in simulation pruned HOT 2
- Explain the lib:Apb3SpiXdrMasterCtrl.scala and SpiXdrMasterCtrl.scala HOT 1
- Async programming in simulation HOT 6
- BusSlaveFactory driveFlow does not honor byteEnable HOT 5
- how can i using axi stream fifo frame mode HOT 2
- Fix nameless enum in VHDL
- How to use clock generated by rtl in spinal sim? HOT 1
- Port names get lost on dev branch HOT 3
- Question about sim data sample and drive delay HOT 18
- Reg(False) / Reg(True) are valid statements HOT 3
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 spinalhdl.