simulationmodelsimquartus

Why is Modelsim displaying "Error: MIF contains illegal character" when I try to simulate?


I'm currently designing a MIPS based processors in VHDL using Quartus 20.1 along with Modelsim 2020.1.

I created a MIF file that (hopefully) calculates the GCD of a given number. My MIF file consists of the following:

Depth = 256;
Width = 32;
Address_radix = hex;
Data_radix = bin;

%This program will calculate the GCD of the values stored in inport0 and inport1%
%Main :%
%lw $s0, FFF8($zero)%
00:10001100000100001111111111111000;
%lw $s1, FFFC($zero)%
01:10001100000100011111111111111100;

%loop:%
%beq $s1, $s0, Exit_the_Loop%
02:00010010001100000000000000001001;        
%sltu $t0, $s1, $s0%            
03:000000010001000110000101011; 
%bne $t0, $zero, skip%          
04:00010101000000000000000000000111;        
%subu $s1, $s1, $s0%        
05:00000010001100011000000000100011;            
%j loop%            
06:00001000000000000000000000000010;        
%skip:% 
%subu $s0, $s0, $s1%            
07:00000010000100001000100000100011;        
%j loop%            
08:00001000000000000000000000000010;        

%Exit_the_Loop:%
%sw $s0, FFFC($zero)%           
09:10101100000100001111111111111100;        
%End:% 
%j  End%                
0A:00001000000000000000000000001010;        
END;

However, everytime I try to simulate my design in modelsim, I get the following error: "Error: MIF contains illegal character0" The error message itself is unclear, I understand that I have an illegal character or some kind of syntax error somewhere in my file, but the error message isn't telling me where. In addition, I've checked my MIF file against others that were working and I see no issue with it off the bat.

Can anyone confirm whether my MIF file has an error somewhere that could be causing this? I'm not sure what else to do.

I tried referencing an example MIF file I keep around for situations like this, but it was no luck. I also tried googling what could be causing this specific error, but also no luck.

Originally, dashes were used instead of percent symbols to represent comments, as I thought that was the issue, but also no bueno.


Solution

  • I figured out the issue, it was a foolish oversight on my part. Props to user16145658 for helping resolve it!

    The reason why it was showing an error was because: i forgot the "content" and "begin" headers.

    Here's the correct MIF file, works as expected!

    Depth = 256;
    Width = 32;
    Address_radix = hex;
    Data_radix = bin;
    CONTENT
    BEGIN
    -- lw $s0, FFF8($zero)
    00:10001100000100001111111111111000;
    -- lw $s1, FFFC($zero)
    01:10001100000100011111111111111100;
    -- beq $s1, $s0, Exit_the_Loop
    02:00010010001100000000000000000110;        
    -- sltu $t0, $s1, $s0   
    03:00000010001100000100000000101011;    
    -- bne $t0, $zero, skip
    04:00010101000000000000000000000010;        
    -- subu $s1, $s1, $s0
    05:00000010001100001000100000100011;            
    -- j loop           
    06:00001000000000000000000000000010;        
    -- subu $s0, $s0, $s1               
    07:00000010000100011000000000100011;        
    -- j loop           
    08:00001000000000000000000000000010;        
    -- sw $s0, FFFC($zero)      
    09:10101100000100001111111111111100;        
    -- j  End           
    0A:00001000000000000000000000001010;        
    END;