1 | |
---|
2 | write_blif - determinize, encode and write an hnode to a blif file |
---|
3 | _________________________________________________________________ |
---|
4 | |
---|
5 | write_blif [-c] [-l] [-e <encoding_file_name>] [-R] [-h] [-v |
---|
6 | <verbosity_value>] [<file>] |
---|
7 | |
---|
8 | Encodes, determinizes, and writes all tables in the current hnode to a |
---|
9 | BLIF file. With the '-l' or '-c' options, or when 'write_blif' is used |
---|
10 | with no options, only the current hnode is written out as a blif file. |
---|
11 | The '-R' option writes the entire hierarchy rooted at the current |
---|
12 | hnode to the blif file, assuming all tables are deterministic and all |
---|
13 | variables are boolean. |
---|
14 | |
---|
15 | Encoding the Multi-Valued Variables: |
---|
16 | |
---|
17 | First, all multi-valued variables in the hnode are binary encoded. |
---|
18 | Each multi-valued variable requires 'm' binary variables in its |
---|
19 | encoding, where m = log2(n). Here 'n' is the number of values in the |
---|
20 | domain of the multi-valued variable. If variable X has n binary |
---|
21 | variables in its encoding, these are called X0, X1, ... X. X0 is the |
---|
22 | least significant encoding variable. The value i of multi-valued |
---|
23 | variable X is encoded such that X0 + 2^1 * X1 + ... + 2^(n-1) * X = i. |
---|
24 | After encoding, each table in the hnode is written out to the blif |
---|
25 | file. |
---|
26 | |
---|
27 | Determinizing Non-Deterministic Tables: |
---|
28 | |
---|
29 | Non-deterministic tables are determinized by adding more binary |
---|
30 | variables to a particular variable's encoding. The variable that is |
---|
31 | chosen is the one that has the smallest number of binary variables in |
---|
32 | its encoding. Determinization is explained by means of an example: |
---|
33 | |
---|
34 | Consider the BLIF-MV table, where each of a, b, and c can have 4 |
---|
35 | values. Each multi-valued variable has two binary variables in its |
---|
36 | encoding. These are called a0, a1, b0, b1, c0 and c1. |
---|
37 | |
---|
38 | .model foo |
---|
39 | |
---|
40 | .inputs a b |
---|
41 | |
---|
42 | .outputs c |
---|
43 | |
---|
44 | .mv a, b, c 4 |
---|
45 | |
---|
46 | .table a b ->c |
---|
47 | |
---|
48 | 2 1 (1,2) |
---|
49 | |
---|
50 | (1,2) 1 3 |
---|
51 | |
---|
52 | .end |
---|
53 | |
---|
54 | The first row of this table represents non-determinism, since for a |
---|
55 | given assignment of input values (i.e. a=2, b=1), the output can take |
---|
56 | on two values (1 or 2). To determinize this row, it is split into two |
---|
57 | rows, each with a unique singleton output value. A new binary variable |
---|
58 | is added to the encoding of a (or b, since in this case each of them |
---|
59 | has the same number of binary variables in its encoding). The new |
---|
60 | variable a2 is given separate values in each of the new rows. The |
---|
61 | resulting blif table looks like: |
---|
62 | |
---|
63 | .model foo |
---|
64 | |
---|
65 | .inputs a0 a1 a2 b0 b1 |
---|
66 | |
---|
67 | .outputs c0 c1 |
---|
68 | |
---|
69 | .names a0 a1 a2 b0 b1 ->c0 c1 |
---|
70 | |
---|
71 | 0 1 0 1 0 1 0 (these two rows represent |
---|
72 | |
---|
73 | 0 1 1 1 0 0 1 row 1 of the MV table) |
---|
74 | |
---|
75 | 1 0 - 1 0 1 1 (these two rows represent |
---|
76 | |
---|
77 | 0 1 - 1 0 1 1 row 2 of the MV table) |
---|
78 | |
---|
79 | .end |
---|
80 | |
---|
81 | Note that this table is still not deterministic, since rows 1 and 4 |
---|
82 | have input minterm(s) in common, but the corresponding outputs are |
---|
83 | different. To resolve this, a new binary variable is added to the |
---|
84 | encoding for b (since b currently has the smallest encoding). For the |
---|
85 | conflicting rows, this variable b2 is assigned different values, and |
---|
86 | for all other rows, it is assigned a '-' value. After this change, |
---|
87 | rows 1 and 4 no longer have common input minterm(s). The intermediate |
---|
88 | table now looks like: |
---|
89 | |
---|
90 | .model foo |
---|
91 | |
---|
92 | .inputs a0 a1 a2 b0 b1 b2 |
---|
93 | |
---|
94 | .outputs c0 c1 |
---|
95 | |
---|
96 | .names a0 a1 a2 b0 b1 b2->c0 c1 |
---|
97 | |
---|
98 | 0 1 0 1 0 1 1 0 |
---|
99 | |
---|
100 | 0 1 1 1 0 - 0 1 |
---|
101 | |
---|
102 | 1 0 - 1 0 - 1 1 |
---|
103 | |
---|
104 | 0 1 - 1 0 0 1 1 |
---|
105 | |
---|
106 | .end |
---|
107 | |
---|
108 | This process is continued until the table is determinized. In this |
---|
109 | example, the final blif file looks like: |
---|
110 | |
---|
111 | .model foo |
---|
112 | |
---|
113 | .inputs a0 a1 a2 a3 b0 b1 b2 |
---|
114 | |
---|
115 | .outputs c0 c1 |
---|
116 | |
---|
117 | .table a0 a1 a2 a3 b0 b1 b2 ->c0 c1 |
---|
118 | |
---|
119 | 0 1 0 - 1 0 1 1 0 |
---|
120 | |
---|
121 | 0 1 1 1 1 0 - 0 1 |
---|
122 | |
---|
123 | 1 0 - - 1 0 - 1 1 |
---|
124 | |
---|
125 | 0 1 - 0 1 0 0 1 1 |
---|
126 | |
---|
127 | .end |
---|
128 | |
---|
129 | Blif allows only single output tables, so in reality the above table |
---|
130 | is split into two single output tables before being written out to the |
---|
131 | blif file. The new binary variables that are thus introduced are |
---|
132 | treated as primary inputs in the blif file. |
---|
133 | |
---|
134 | We make no claim on the optimality of this process, just that it is |
---|
135 | simple. It may turn out that the number of new variables is much |
---|
136 | larger than the optimum one. |
---|
137 | |
---|
138 | Interfacing Between Binary and Multi-Valued Variables: |
---|
139 | |
---|
140 | In order for the SIS-optimized version of this file to be read back |
---|
141 | into VIS, we need to re-create the corresponding multi-valued |
---|
142 | variables. For this purpose, interface information (model name, input |
---|
143 | and output declarations for the hnode) is written out to a special |
---|
144 | encoding file (e.g. foo.enc). Additionally, binary->multi-valued |
---|
145 | encoding tables are written to the encoding file for each PO. In the |
---|
146 | above example, the binary->multi-valued table for variable c looks |
---|
147 | like |
---|
148 | |
---|
149 | .table c0 c1 -> c |
---|
150 | |
---|
151 | 0 0 0 |
---|
152 | |
---|
153 | 1 0 1 |
---|
154 | |
---|
155 | 0 1 2 |
---|
156 | |
---|
157 | 1 1 3 |
---|
158 | |
---|
159 | and this can be seen as a decoder of the binary variables. Similarly, |
---|
160 | multi-valued->binary encoding tables are written to the encoding file |
---|
161 | for each PI. The multi-valued->binary table for variable b in the |
---|
162 | above example is: |
---|
163 | |
---|
164 | .table b -> b0 b1 |
---|
165 | |
---|
166 | 0 0 0 |
---|
167 | |
---|
168 | 1 1 0 |
---|
169 | |
---|
170 | 2 0 1 |
---|
171 | |
---|
172 | 3 1 1 |
---|
173 | |
---|
174 | and this can be seen as an encoder of the multi-valued variables. |
---|
175 | Similar tables are written to the encoding file for sub-circuit inputs |
---|
176 | and outputs. Likewise, such tables are written out for latch inputs |
---|
177 | and outputs. This is needed so that the original multi-valued latches |
---|
178 | can be reinstated while the blif file is being read back into VIS. |
---|
179 | These multi-valued latch declarations are written to the encoding file |
---|
180 | during the write_blif process. |
---|
181 | |
---|
182 | The combination of this encoding file and the blif file results in a |
---|
183 | legal BLIF-MV hnode description. |
---|
184 | |
---|
185 | If no file is specified, the blif file is written out to the standard |
---|
186 | output. If the encoding file is not specified, encoding information is |
---|
187 | written out to .enc. |
---|
188 | |
---|
189 | Options: |
---|
190 | |
---|
191 | The '-R' option writes the entire hierarchy rooted at the current |
---|
192 | hnode to the blif file, first checking that all tables are |
---|
193 | deterministic and all variables are boolean. Other options ('-c', |
---|
194 | '-l', or write_blif with no options) only write out the current hnode. |
---|
195 | Also, when the '-R' option is specified, no encoding file is written |
---|
196 | since none is needed. |
---|
197 | |
---|
198 | Command options: |
---|
199 | |
---|
200 | -c |
---|
201 | Writes only combinational part to blif file. |
---|
202 | |
---|
203 | -l |
---|
204 | Writes out latches, making latch IOs primary outputs in the |
---|
205 | blif file. |
---|
206 | |
---|
207 | -e <encoding_file_name> |
---|
208 | If set, the program writes the encoding information into this |
---|
209 | file. The default is the model name for the current node |
---|
210 | extended by .enc. |
---|
211 | |
---|
212 | -R |
---|
213 | Recursively writes out the entire hierarchy rooted at the |
---|
214 | current hnode to the blif file. In this sub-hierarchy, all |
---|
215 | tables must be deterministic and all variables must be boolean. |
---|
216 | Either of the -c, -l or -e options cannot be used together with |
---|
217 | this option. |
---|
218 | |
---|
219 | -h |
---|
220 | Prints the command usage. |
---|
221 | |
---|
222 | -v <verbosity_value> |
---|
223 | Specifies verbosity level, an integer less than 3. |
---|
224 | |
---|
225 | <file> |
---|
226 | name of blif file to be written, default is standard output. |
---|
227 | |
---|
228 | Note that if neither the -c or the -l options are chosen, then |
---|
229 | latches are written out, without making latch IOs primary |
---|
230 | outputs in the blif file. Currently the files written out using |
---|
231 | this option cannot be read back into VIS. |
---|
232 | _________________________________________________________________ |
---|
233 | |
---|
234 | Last updated on 20050519 10h16 |
---|