Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Error loop must terminate within 10,000 iterations (vhdl)

Status
Not open for further replies.

mcvs21

Newbie level 1
Joined
Jun 13, 2019
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
28
Can someone help me solve this problem?

I try to compile this code on quartus andd everytime appear this erro:

Error (10536): VHDL Loop Statement error at InstructionMemory.vhd(31): loop must terminate within 10,000 iterations

Its my code below:


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
library ieee;
library std;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;
 
--
entity InstructionMemory is
    port (
        clk, rst : in std_logic;
        address : in std_logic_vector(31 downto 0);
        instr_out : out std_logic_vector(31 downto 0)
    );
end entity;
architecture aim of InstructionMemory is
 
    type instr_mem is array(0 to 20) of std_logic_vector(31 downto 0);
    signal imem : instr_mem := (others => (others => '0'));
 
begin
    process (clk)
        file file_pointer : text;
        variable line_content : string (1 to 32);
        variable line_num : line;
        variable i : integer := 0;
        variable j : integer := 0;
        variable char : character := '0';
    begin
 
        file_open(file_pointer, "C:/Users/MM/Desktop/PF3/MIPS-Monocycle-32-bits-master/Testcases/instructions.txt", READ_MODE);
        while not endfile (file_pointer) loop -- this is line 31
            readline(file_pointer, line_num);
            READ(line_num, line_content);
 
            for j in 1 to 32 loop
                char := line_content(j);
                if (char = '0') then
                    imem(i)(32 - j) <= '0';
                else
                    imem(i)(32 - j) <= '1';
                end if;
            end loop;
            i := i + 1;
        end loop;
        file_close(file_pointer); -- Close the file
        wait;
    end process;
 
    process (clk, rst)
    begin
        if rst = '1' then
            instr_out <= "00000000000000000000000000000000";
        elsif clk'EVENT and clk = '0' then
 
                assert (( (to_integer(unsigned(address)) mod 4194304)/4) < instr_mem'LENGTH)
                report  "Simulation has ended"
                severity ERROR;
            instr_out <= imem((to_integer(unsigned(address)) mod 4194304)/4);
        end if;
    end process;
end architecture;



This is the line 31:
Code:
while not endfile (file_pointer) loop -- this is line 31

I dont know if the path of the instruction is wrong.

this is the size of intructions, 22 lines.

00000000111100000000100010010011
00000001010000000000100100010011
00000000101000000000100110010011
00000000010100000000101000010011
00000000001000000000101010010011
00010000000000000000111010010111
11111110110011101000111010010011
00000000000010101010111000110011
00000010000011100001110001100011
00000000010010101010111000010011
00000010000011100000100001100011
00000000001011100001001100010011
00000001110100110000001100110011
00000000000000110010001010000011
00000000000000101000000001100111
00000001010010011000010000110011
00000001100000000000000001101111
00000001001001001000010000110011
00000001000000000000000001101111
01000001001001001000010000110011
00000000100000000000000001101111
01000001010010011000010000110011
 

You are trying to synthesize a test bench in Quartus, this makes no sense. What do you want to achieve?
 


We can surely discuss how to write synthesizable memory initialization. But this is pure test bench code.
 

Last edited:

No, Altera/Intel doesn't support textio for memory initialization. But that's not my point. The typical VHDL test bench code starts with a non synthesizable infinite loop and stops with "Simulation has ended".
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top