Contatore Cifre
Il seguente programma, conterà quanti 1 sono presenti in una sequenza di 4 cifre (binarie).
Vi ricordo che avremo solo 4 input (quindi al massimo quattro 1) e 3 output (quindi al massimo 1 0 0).
.model contat .inputs x y v w .outputs p2 p1 p0 .names x y v w p0 0001 1 0010 1 0100 1 1000 1 0111 1 1011 1 1101 1 1110 1 .names x y v w p1 0011 1 0101 1 0110 1 1001 1 1010 1 1100 1 0111 1 1011 1 1101 1 1110 1 .names x y v w p2 1111 1 .end
Per ogni dubbio non esitate a commentare!!
No trackbacks yet.