Si, meglio contestualizzare e spiegare meglio
Il file di origine è questo:
codice:
0 input
1 input
2 input
3 input
4 gate arity 2 table [ 0 1 1 0 ] inputs [ 2 3 ]
5 gate arity 2 table [ 0 0 0 1 ] inputs [ 2 0 ]
6 gate arity 2 table [ 0 1 1 0 ] inputs [ 4 1 ]
7 gate arity 2 table [ 0 1 1 0 ] inputs [ 5 6 ]
8 output gate arity 1 table [ 0 1 ] inputs [ 7 ]
9 gate arity 2 table [ 0 1 1 0 ] inputs [ 0 1 ]
10 gate arity 2 table [ 0 0 0 1 ] inputs [ 0 2 ]
11 gate arity 2 table [ 0 1 1 0 ] inputs [ 9 3 ]
12 gate arity 2 table [ 0 1 1 0 ] inputs [ 10 11 ]
13 output gate arity 1 table [ 0 1 ] inputs [ 12 ]
E' un linguaggio che descrive un circuito booleano. il primo numero di ogni riga identifica il "filo" del circuito.
Quindi abbiamo 4 input. Il filo 4 è l'output del gate di arietà 2 che prende in input i fili 2 e 3. Tale gate ha la tabella di verità [0110] (uno xor)
L'8 e il 13 sono i fili in output, cioè gli output finali dell'intero circuito/funzione.
Devo trasformarlo in un formato standard
codice:
.model nomecircuito
.inputs x0 x1 x2 x3
.outputs y0 y1
.names x2 x3 x4
01 1
10 1
.names x2 x0 x5
11 1
.names x4 x1 x6
01 1
10 1
.names x5 x6 x7
01 1
10 1
.names x7 y0
1 1
.names x0 x1 x9
01 1
10 1
.names x0 x2 x10
11 1
.names x9 x3 x11
01 1
10 1
.names x10 x11 x12
01 1
10 1
.names x12 y1
1 1
.end
.inputs e .outputs indicano gli ingressi e le uscite del circuito. Ogni .names indica un gate (porta logica). I primi valori dopo .names indicano gli input di tale gate, mentre l'ultimo indica l'output del gate.
Le righe sotto il .names indicano i valori in input per cui l'output di tale gate dovrà essere 1.
Ad esempio prendiamo il primo:
codice:
.names x2 x3 x4
01 1
10 1
L'output di tale gate sarà 1 solo quando gli input saranno 01 oppure 10 (cioè una porta xor)