Marco Breiling Posted September 30, 2021 Report Share Posted September 30, 2021 Dear all, I have a question similar to https://forums.accellera.org/topic/2126-genericruntime-specification-of-ports/ I want to sweep through a set of wordlengths in a design space exploration task, i.e. test whether the system (including functional behaviour of the algorithm) works with signals of type sc_fix with e.g. 3 integer + 3 fractional bits, 2+4 or 4+2. All with the same build target (i.e. without re-compiling every time), i.e. the word lengths of the signals and corresponding module ports should be read from a file and then be used in the constructors (of the signals, and module-ports) at run-time. However, I did not succeed. My approach was to pass the wordlengths of the sc_fix to the constructor of sc_signal (or the port), but there is apparently no sc_signal, sc_in, … constructor that accepts this additional input. My next approach was, that the sc_signal<sc_fix> can apparently be configured by the current context parameters, when it is constructed. When I have ports in a module, however, they are constructed “en bloc” (during module construction) and I cannot set the context for each port individually. So this approach does not work either. Do you maybe have an idea how to solve the problem? Many thanks in advance, Marco Quote Link to comment Share on other sites More sharing options...
Marco Breiling Posted October 15, 2021 Author Report Share Posted October 15, 2021 Does no-one have an idea, has this already been covered somewhere else or is my question so stupid? Quote Link to comment Share on other sites More sharing options...
maehne Posted October 19, 2021 Report Share Posted October 19, 2021 Your question is not stupid at all, but requires knowledge of some less widely known corners of the IEEE Std 1666-2011. Typically, people constrain the word length of their data types using the template parameters, because this has the additional advantage of enforcing correct connectivity. As you noted, the port and signal types construct the value types using their default constructor. So, to configure the word lengths as required in your use case, you will have to profit from the fact that SystemC integers and vectors get their default length from the current sc_dt::sc_length_context in scope. I recommend to read up on the topic in chapter 7 of IEEE Std 1666-2011, in particular clause 7.2.3 "Base class default word length". I think this should allow you to implement all aspects of your use case. Marco Breiling 1 Quote Link to comment Share on other sites More sharing options...
Marco Breiling Posted October 31, 2021 Author Report Share Posted October 31, 2021 Many thanks for your very helpful answer! I will check the standard and try out your recommendation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.