I want to read a file in Verilog that contains both positive and negative numbers. For example, the file contents are:
-4
20
28
-52
and so on.
Also, after reading I have to multiply these numbers with a signal. I'm confused how to read these numbers.
One approach is to use $readmemb()
directive, but it requires numbers in binary format. That can be done easily, but what about the negative numbers, in which format does Verilog accept negative numbers, 1's complement, 2's complement or signed MSB format?