However, one more thing must be done when people copy it to make their own arbitrary bus sizes: rename the module within the veriloga code!
For example, a 16 bit bus would need:
module busset8(outbus); -> module busset16(outbus);
Also, a question about these bussets. Can the setval parameter be changed at some point in time during a transient simulation? If so, what are the various options for doing so and which do you recommend?
You are right - I guess I assumed that copying and renaming the cell (hopefully to a library under your own control!) went without saying, but I should have included that step.Regarding whether (or how) you would change the setval during simulation, I can not think of how you would be able to do that with the cell as it is. Of course, you could use a couple of them, set to different values, and then analog switches to toggle between, but that's a bit messy. I think ideally a knowledgable Veriloga writer (which I am not) would probably be better off building a version of this cell that takes a voltage input as the "setval" parameter. Then, a vpwl or vpulse could be used to dynamically change the setval property. - Hugh
Yes, I have done the messy method, but am looking for a cleaner solution. :-)
Alas, I am not very experienced with Veriloga either (usually I know just enough to get by on), so I am hoping someone might help us. Hint, hint...
Somehow, I was under the impression that the bit assignment was only performed at the beginning of a simulation due to the use of the 'generate' command. Thus, adding another input to be driven by a source would not help. Anyone know more about this?
Actually, I am not thinking very clearly here - what you are really looking for is simply an ideal DAC. There already exists such an animal in the bms library, called dac_BiOB_8. If you set up the reference voltage correctly, then you can just feed this an analog input voltage and get whatever digital output you want. (For this particular DAC you will also need to feed it a clock signal each time you change the value.)It appears that this, too, could be copied (to a different name!) and scaled to a different bus size by changing the internal SIZE parameter (plus pin names, etc., and maybe also the internal note that talks about number of states, just to be consistent). I have not tried it though, so no guarantees!- Hugh
OOPS! What I meant to say was, an ideal ADC - not a DAC! There is one of those too in bmslib - called adc_BiOB_8. And the parameter you would change appears to be the HIBIT parameter.Sorry for any confusion.- Hugh