Many older tools can have problems with constant functions, although most recent releases have fixed this. ![]() Also, the function does not need to behave the RTL rules for synthesizable code. A couple of things to note however, are that the function can be called before it is declared. See my post on using recursion to implement a priority encoder to see the whole body of the module. Now with constant functions, you just need to specify the input width. Without constant functions, you need to specify both the input and output widths when instantiating the module. You pass in an n -bit input vector and produce a log 2 n encoded result. So what are they good for? Consider a priority encoder. Also, they can only have constants or parameters as inputs. The rules for constant functions are pretty simple. One great example of a constant function is the log2 function. That is when parameters are evaluated and generate statements are expanded. ![]() ![]() Constant functions are a great feature introduced in Verilog In a nutshell, constant functions allow you to write functions that are used at elaboration time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |