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