1srec_mif(5) File Formats Manual srec_mif(5)
2
3
4
6 srec_mif - Memory Initialization File (MIF) format
7
9 This format was invented by Altera.
10
11 An ASCII text file (with the extension .mif) that specifies the initial
12 content of a memory block (CAM, RAM, or ROM), that is, the initial val‐
13 ues for each address. This file is used during project compilation
14 and/or simulation. You can create a Memory Initialization File in the
15 Memory Editor, the In‐System Memory Content Editor, or the Quartus II
16 Text Editor.
17
18 A Memory Initialization File serves as an input file for memory ini‐
19 tialization in the Compiler and Simulator. You can also use a Hexadeci‐
20 mal (Intel‐Format) File (.hex) to provide memory initialization data.
21
22 A Memory Initialization File contains the initial values for each
23 address in the memory. A separate file is required for each memory
24 block. In a Memory Initialization File, you must specify the memory
25 depth and width values. In addition, you can specify data radixes as
26 binary (BIN), hexadecimal (HEX), octal (OCT), signed decimal (DEC), or
27 unsigned decimal (UNS) to display and interpret addresses and data val‐
28 ues. Data values must match the specified data radix.
29
30 When creating a Memory Initialization File in the Quartus II Text Edi‐
31 tor, you must start with the DEPTH, WIDTH, ADDRESS_RADIX and DATA_RADIX
32 keywords. You can use Tab "" and Space " " characters as separators,
33 and insert multiple lines of comments with the percent "%" character,
34 or a single comment with double dash "--" characters. Address:data
35 pairs represent data contained inside certain memory addresses and you
36 must place them between the CONTENT BEGIN and END keywords, as shown in
37 the following examples.
38 % multiple‐line comment
39 multiple‐line comment %
40 -- single‐line comment
41 DEPTH = 8; -- The size of data in bits
42 WIDTH = 32; -- The size of memory in words
43 ADDRESS_RADIX = HEX; -- The radix for address values
44 DATA_RADIX = BIN; -- The radix for data values
45 CONTENT -- start of (address : data pairs)
46 BEGIN
47 00 : 00000000; -- memory address : data
48 01 : 00000001;
49 02 : 00000010;
50 03 : 00000011;
51 04 : 00000100;
52 05 : 00000101;
53 06 : 00000110;
54 07 : 00000111;
55 08 : 00001000;
56 09 : 00001001;
57 0A : 00001010;
58 0B : 00001011;
59 0C : 00001100;
60 END;
61
62 There are several ways to specify the address and data, as seen in the
63 following table:
64
65 Notation Interpretation Example
66
67 A : D; Addr[A] = D 2 : 4
68 Address: 01234567
69 Data: 00400000
70 [A0..A1] : D; Addr[A0] to [A1] [0..7] : 6
71 (See note below.) contain data D Address: 01234567
72 Data: 66666666
73 [A0..A1] : D0 D1; Addr[A0] = D0, [0..7] : 5 6
74 (See note below.) Addr[A0+1] = D1, Address: 01234567
75 Addr[A0+2] = D0, Data: 56565656
76 Addr[A0+3] = D1,
77 until A0+n = A1
78 A : D0 D1 D2; Addr[A] = D0, 2 : 4 5 6
79 Addr[A+1] = D1, Address: 01234567
80 Addr[A+2] = D2 Data: 00456000
81
82 Note: The address range forms are limited in SRecord, the range must be
83 less than 255 bytes. SRecord will never write an address range.
84
85 Note: When reading MIF file, SRecord will round up the number of bits
86 in the WIDTH to be a multiple of 8. Multi‐byte values will be laid
87 down in memory as big‐endian.
88
89 An ASCII text file (with the extension .mif) that specifies the initial
90 content of a memory block (CAM, RAM, or ROM), that is, the initial val‐
91 ues for each address. This file is used during project compilation
92 and/or simulation. A MIF contains the initial values for each address
93 in the memory. In a MIF, you are also required to specify the memory
94 depth and width values. In addition, you can specify the radixes used
95 to display and interpret addresses and data values.
96
98 In general, binary data will expand in sized by approximately 3.29
99 times when 8‐bit data is represented with this format (16 bit = 2.75,
100 32 bit = 2.47, 64 bit = 2.34).
101
103 Following is a sample MIF:
104 DEPTH = 32; % Memory depth and width are required %
105 % DEPTH is the number of addresses %
106 WIDTH = 14; % WIDTH is the number of bits of data per word %
107 % DEPTH and WIDTH should be entered as decimal numbers %
108 ADDRESS_RADIX = HEX; % Address and value radixes are required %
109 DATA_RADIX = HEX; % Enter BIN, DEC, HEX, OCT, or UNS; unless %
110 % otherwise specified, radixes = HEX %
111 --Specify values for addresses, which can be single address or range
112 CONTENT
113 BEGIN
114 [0..F]: 3FFF; % Range: Every address from 0 to F = 3FFF %
115 6 : F; % Single address: Address 6 = F %
116 8 : F E 5; % Range starting from specific address %
117 -- % Addr[8] = F, Addr[9] = E, Addr[A] = 5 %
118 END;
119
121 The above information was gleaned from the following sources:
122 http://www.altera.com/support/software/nativelink/quartus2/glossary/def_mif.html
123 http://www.mil.ufl.edu/4712/docs/mif_help.pdf
124
126 srec_mif version 1.64
127 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
128 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Peter Miller
129
130 The srec_mif program comes with ABSOLUTELY NO WARRANTY; for details use
131 the 'srec_mif -VERSion License' command. This is free software and you
132 are welcome to redistribute it under certain conditions; for details
133 use the 'srec_mif -VERSion License' command.
134
136 Scott Finneran E‐Mail: scottfinneran@yahoo.com.au
137 Peter Miller E‐Mail: pmiller@opensource.org.au
138
139
140
141Reference Manual SRecord srec_mif(5)