1srec_mem(5) File Formats Manual srec_mem(5)
2
3
4
6 srec_mem - Lattice Memory Initialization format
7
9 A Lattice Memory Initialization format (.mem), by Lattice Semiconduc‐
10 tor, file is an ASCII text file that consists of a header followed by
11 lines of memory data.
12
13 Syntax
14 The data must be in one of the following formats: Bin (binary), Hex
15 (hexadecimal), or Address‐Hex (described below).
16
17 For hexadecimal values, both upper and lower case can be used. If the
18 data has fewer bits than the specified data width, the most significant
19 bits are filled with 0. Any address not specified will be filled with
20 0.
21
22 Comments can be added at any point after the header (defined below) by
23 starting the comment with a pound sign (#) or two slashes (//). The
24 comment then includes everything to the end of the line. Comments may
25 be added to any of the data, but never add comments to the header.
26
27 Header
28 A .mem file starts with a header, which declares the file format, mem‐
29 ory size, and address and data display radix for Memory Generator. The
30 syntax of the header is:
31 #Format=Bin | Hex | AddrHex
32 #Depth=1 to 65536
33 #Width=1 to 256
34 #AddrRadix=index‐number
35 #DataRadix=index‐number
36 #Data
37 The index‐number can be one of the following numbers. AddrRadix and
38 DataRadix can have different values.
39 Binary: 0
40 Octal: 1
41 Decimal: 2
42 Hexadecimal: 3
43
44 For example, the following header says the .mem file is using the
45 binary format for a 32x8 memory. When displayed in Memory Generator,
46 the address will be shown in hexadecimal and the data will be shown in
47 binary.
48 #Format=Bin
49 #Depth=32
50 #Width=8
51 #AddrRadix=3
52 #DataRadix=0
53 #Data
54
55 Bin and Hex Formats
56 The data is represented in binary or hexadecimal format. Each line of
57 data specifies the contents for one memory location, starting with
58 address 0. That is, the first line is for address 0, the second line
59 is for address 1, and so on. For each line, the data is interpreted as
60 least significant bit on the right.
61
62 For example, in the Bin format, the following lines will initialize
63 address 0 to “00011011”, address 1 to “11111010” (assuming it is a 32x8
64 memory).
65 # for a 32x8 memory
66 11011
67 11111010
68
69 In the Hex format, the following lines will initialize address 0 to
70 “003B”, address 1 to “FB0A” (assuming it is a 32x16 memory).
71 # for a 32x16 memory
72 3B
73 FB0A
74
75 AddrHex
76 The data is represented in hexadecimal format. Each line consists of
77 an address followed by a colon and then any number of data words, sepa‐
78 rated by spaces:
79 address: data data> data...
80 The data will be applied starting at <address> and filling in sequen‐
81 tially from there.
82
83 For example:
84 A0:03 F3 3E 4F
85 B2:3B 9F
86 will initialize A0 with 03, A1 with F3, A2 with 3E, A3 with 4F, B2 with
87 3B, and B3 with 9F. The other addresses will be initialized to 0. So
88 A4 through B1 will be set to 0.
89
90 See Also
91 http://help.latticesemi.com/docs/webhelp/eng/wwhelp/wwhimpl/common/html/wwhelp.htm#href=Design%20Entry/memory_initialization_file.htm#1371843&single=true
92
93 Size Multiplier
94 The size multiplier depends on the width selected. As files grow
95 larger, their size multipliers will approach those in the table, from
96 above.
97
98 Width Linux Windows
99 8 2.96 3.0
100 16 2.47 2.5
101 32 2.25 2.28
102 64 2.13 2.15
103
104 Byte Order
105 This format is implicitly big‐endian. Use a -byte‐swap filter if you
106 need something different.
107
109 srec_mem version 1.64
110 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
111 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Peter Miller
112
113 The srec_mem program comes with ABSOLUTELY NO WARRANTY; for details use
114 the 'srec_mem -VERSion License' command. This is free software and you
115 are welcome to redistribute it under certain conditions; for details
116 use the 'srec_mem -VERSion License' command.
117
119 Scott Finneran E‐Mail: scottfinneran@yahoo.com.au
120 Peter Miller E‐Mail: pmiller@opensource.org.au
121
122
123
124Reference Manual SRecord srec_mem(5)