Closed philipaxer closed 4 years ago
Thank you for the request. I will put this on my TODO list.
There are actually two features requested:
Power operator should be straightforward to implement.
Parameterization on size/width, on the other hand, is an afterthought after most of the system design is done. Initially we don't allow such behavior, since you can always use Python metaprogramming do to the work. For instance, in your example:
addr_width = 8 # this is a generator parameter as Python int
mem = self.var("mem", width=data_width, size= 2**addr_width)
This will generate a perfectly fine circuit. The downside for that, as we've seen from many other generator frameworks, is that a numbers of different RTL modules get generated simply because the width is different. That's why we introduce the width parameterization later on to improve the codegen quality.
That being said, since this is not a blocking issue, it might not get implemented in the near future (and it will also need some significant rewrite on how we do width checking).
See test example here: https://github.com/Kuree/kratos/blob/master/tests/test_generator.py#L1967
Hi, This is a feature request to extend arithmetic on parameters to include power.
Generator parameters are typically used to derive downstream values using arithmetic expressions. E.g. in memory implemententations, the memory depth is derived by 2**addr_width. The result is then used to size the memory array.
The above statement is giving me an error, but is a common use-case.
Ideally, i would like to generate a local parameter in the target sv as follows: