Comments (7)
Hi lycfly,
The first component that is instantiated registers itself as the toplevel component, which is later used e.g. for the name of the module. (it has to so that components inside it can add themselves as subcomponents).
modB
in your first example is never really inserted into the internal data model.
I think we should add an error for this corner case.
What's your use-case, what would you like to achieve in the end?
from spinalhdl.
Hi andreasWallner,
Actually I define an SpinalEnum in moduleA and some elements is dynamically added when moduleA is instanced according to the Config. ModuleB will use this dynamically added elements of Enum object so I need to instance moduleA before.
I am just testing whether ModuleB can get this elements, so I write this code in the generate function and find it does not generate the rtl code as I expected.
from spinalhdl.
@lycfly As it is at the moment that doesn't work (for the reason I desribed above) - is it possible for you to move the "common code" outside of ModuleA so that both can call it?
from spinalhdl.
@lycfly As it is at the moment that doesn't work (for the reason I desribed above) - is it possible for you to move the "common code" outside of ModuleA so that both can call it?
Yes, these two modules can be instantiated in an top module.
The code above is for test, and I was just confused about the generate function's behavior.
Thanks for your reply and I will avoid this usage next time.
from spinalhdl.
@Dolu1990 I think it would make sense to generate sat least a warning for the case above, what do you think about that?
from spinalhdl.
Yes, i added a check for it to make an error.
Will give you a "MULTIPLE TOPLEVEL : SpinalHDL only allows a single toplevel Component."
from spinalhdl.
The check can be turned off via the SpinalConfig(singleTopLevel = false)
from spinalhdl.
Related Issues (20)
- XSim on Windows : getting it to work as expected through cmd or MSYS2(MINGW64) HOT 33
- 『Requirement And Idea』SpinalHDL generated verilog code parameterization and generate block simplification requirements. HOT 13
- Ability to specify path to make binary HOT 6
- Bad interaction between Bits.aliasAs and Data.as HOT 2
- How to understand the Simulated behavior in SpinalHDL? HOT 4
- spinal.lib.misc.pipeline refractoring
- 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 7
- 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
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.