I am designing a module, which operates on an array of integers. The module is designed for a maximum array size of 16 integers, however, it can be less than 16 as well.
I was thinking that when an array of size lesser than 16 is fed to the module, the rest of the positions would assume 'Z' (high impedance/tristate) value.
I would like to ask if there's any better approach, or popular good practices to handle such situations.
I cannot say Z is a good solution for this. Technically, you could make your input look like a tristate bus of sorts, but this is odd. A better solution is to have a little protocol in mind, so the number of expected integers is known in advance. Use an additional port or a FIFO with empty signal utilized to mark there are no more integer values coming.
I cannot say Z is a good solution for this. Technically, you could make your input look like a tristate bus of sorts, but this is odd. A better solution is to have a little protocol in mind, so the number of expected integers is known in advance. Use an additional port or a FIFO with empty signal utilized to mark there are no more integer values coming.
Thanks a lot for the tips! I have added a new port to accept the number of integers, and an internal signal to keep track of the first empty position.
I cannot use FIFO because my logic requires going back and forth across the array.