nand2vm
1.0.0
الهدف من هذا المشروع هو إنشاء نسخة بيثون من Nand2Tetris ، وتشمل NAND2VM جناح الاختبار الكامل لـ Nand2Tetris ، و Assembler مع إصدار Python.
يتم استخدام bitarray عند معالجة بيانات بت ، باستخدام BitArray API ، يمكننا إنشاء مجموعة بت 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
1101البوابة الوحيدة باستخدام مشغل Python لبناء
> >> def Nand ( a : bool , b : bool ) -> bool :
... return not ( a and b )
> >> nand2vm . Nand ( True , True )
False
> >> nand2vm . Nand ( True , False )
True
> >> تنفيذ المشروع 1:
تنفيذ المشروع 2:
تنفيذ المشروع 3:
تنفيذ المشروع 6: