I am a newbie in verifying complex FPGA designs. In my testbench, I am reading the test vectors from a text file and assigning them to the input ports of my FPGA design. Thats when I find the above error while reading the first line of my text file. Sample data in text file, error log and my testbench code are in the attached file.
Please let me know if something is not clear in my explanation, and guide me to solve the error.
What library/package are you using to do this? You don't show that part of your code. A typical setup would be:
and I don't see that you've set up a file handle:
FILE vectorfile: TEXT OPEN READ_MODE IS "input_vectors.txt";
And if you're using TEXTIO, you don't need to read the spaces. They're skipped automatically.
Typically, VHDL testbench would have a bone
1. Library,package used
2. Tb Entity declaration,
3. Testbench arcitecture
I only see the procedure to read input file, no UUT, component declaration and port mapping signal. You may find below link helpful creating VHDL Tb
Some tutorial of testbench with reading file for value of input port.
Below link is full flow of creating project --> HDL file create --> Tb create (using Quartus template after you compile) --> simulation flows
Generate TB using Modelsim (muc more easier)
Sorry for not posting the complete testbench. I thought the logic implemented in the process would be sufficient to convey the information. The below attachment has the complete testbench.
Also, I found out that the error was due to not reading the first data (time value) from the text file in the right manner. After removing the time values from the text file, I could see that the simulation started and test vectors were assigned to the input ports. I have the below questions:
1. How do I read the real value data ex: 206.3, 209.8, 210.2 etc from a text file in my testbench?
2. How do I drive the bidirectional data bus in my testbench? I have tried this in line 151 of the attachment. Let me know if this is correct:
s_AD <= s_AD_temp when s_E = '1' else (others => 'Z');
Thank you very much in advance!
Hello, a short Update:
I could find a way to read real values. Just created a real variable and multiplied it with 1 ns and assigned it to time variable.
variable a: time;
variable b: real;
a = b * 1 ns;
I am using the s_WRN and s_RDN signals being sent to DUT to decide read and write operation.
I wrote something like this outside the process:
s_AD <= s_AD_temp when s_WRN = '0' else
(others => 'Z') when s_RDN = '0' else
So, I am writing s_AD_temp to s_AD when S_WRN is enabled, driving s_AD to "Z" when the DUT has to perform write operation or else s_AD is same as it is.