I have got two different multiplier modules.
1. 4x4 multiplier
2. 8x8 multiplier
Based on the length of the inputs a and b, one of these modules should be selected. I have written a code where enable becomes high when any of the input length is greater than 4 bit(binary). I cannot instantiate a module inside if or case statement and not even inside an always block. I tried using generate blocks. Since the parameter value is fixed, in all the cases it chooses only one of the modules. I donot know how to use `define,`ifdef `elseif. Please do let me know, how can i acheive this logic in verilog and also the use of generate and `define,`ifdef `elseif.
Are you asking about a parameterizable module, where the bit length of some inputs is defined by a parameter, or do you mean that the length is variable at runtime? A generate construct can only work for the first case.
Are you asking about a parameterizable module, where the bit length of some inputs is defined by a parameter, or do you mean that the length is variable at runtime? A generate construct can only work for the first case.
In the generate-if case given above, SIZEPAR is fixed. Therefore it will always instantiate 8x8 multiplier. If the input size is 4 and lesser it has to instantiate 4x4 multiplier. I doubt that will happen.
Yes, I mean the length of the inputs are variable at runtime. In that case what do you do?
[/QUOTE]
even in the above case, It will always instantiate 8x8 block. There is no flexibility.
What I mean is, Depending on the size of the input at the very instant(runtime), It should decide between these modules.