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)
- Timescale of the trace file generated by Verilator does not match the value defined in the scala simulation setup
- defualtReadBits spelling mistake HOT 1
- no waveforms displayed when using xsim HOT 5
- SystemVerilog Generation
- switch SInt support
- switch SInt support
- XSIM backend not working on Linux
- Problems with `setCompositeName` in combination with `removePruned` HOT 1
- Run test for InterfaceTesterCocotbBoot failed when only use 2.11 scala compilier. HOT 1
- LATCH DETECTED from the combinatorial signal HOT 3
- XSim in spinalhdl fail to simulate IPs like FFT or complex multiplier, but works fine in Vivado HOT 3
- Assign bits (BigInt) back to Bundle/Union/Enum in SpinalSim HOT 8
- Memory of Depth 1 Produces Unhelpful Error Message HOT 1
- Inconsistent naming for nested `Composite` areas HOT 2
- Add support for AMBA5 CHIοΌ HOT 1
- synchronous StreamFork valid/ready are not decoupled properly HOT 3
- regif's html doc not support setname function
- duplicate module when multi inst
- Outer FSM `whenIsActive` statements always win vs. nested FSM `onEntry` statements for combinational logic HOT 2
- Vivado/Vitis post simulation 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.