nand2vm
1.0.0
O objetivo deste projeto é criar uma versão python de Nand2tetris, o Nand2VM inclui o conjunto de testes completo de Nand2tetris e o assembler com versão Python.
O BITARRAY é usado quando manipula dados de bits, usando a API BITARRAY, podemos criar rapidamente uma pequena matriz de bits Endian:
> >> import nand2vm
# Init from list using big endian
> >> b = nand2vm . BitArray ([ True , True , False , True ])
> >> b
1101
> >> b [ 0 ]
True
> >> b [ 1 ] # Internal using small endian
False
> >> b . data
[ True , False , True , True ]
# Init from integer, default using 16 bits
> >> b = nand2vm . BitArray ( - 1 )
> >> b # 16 bits 2's complement
1111111111111111
# Init from string
> >> b = nand2vm . BitArray ( '1101' )
> >> b
1101O único portão usando o operador python para construir
> >> def Nand ( a : bool , b : bool ) -> bool :
... return not ( a and b )
> >> nand2vm . Nand ( True , True )
False
> >> nand2vm . Nand ( True , False )
True
> >> Projeto 1 Implemento:
Projeto 2 Implementar:
Projeto 3 Implemento:
Projeto 6 Implementar: