diff options
| -rw-r--r-- | fibonacci.py | 10 | ||||
| -rw-r--r-- | write_prog_eeprom.py | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/fibonacci.py b/fibonacci.py new file mode 100644 index 0000000..d01139d --- /dev/null +++ b/fibonacci.py @@ -0,0 +1,10 @@ +import inst + +## this programm computes the fibonacci sequence + +## load the start values 1 and 1 into the two registers +## add the content of the two registers and save it alternating into the two +## registers, an repeat +prog = [inst.INST_LDA | 0x1, inst.INST_LDB | 0x1, inst.INST_REG_A_OUT, + inst.INST_ADD_A, inst.INST_REG_A_OUT, inst.INST_ADD_B, + inst.INST_REG_B_OUT, inst.INST_PC_LOAD | 0x3] diff --git a/write_prog_eeprom.py b/write_prog_eeprom.py index a7440cf..80fcc2d 100644 --- a/write_prog_eeprom.py +++ b/write_prog_eeprom.py @@ -3,7 +3,7 @@ ## programm start at 0x00 import test_prog -import fibonacci_prog +import fibonacci import eeprom_pi as ep @@ -14,11 +14,13 @@ prog = None if len(sys.argv) == 2: if sys.argv[1] == "test": prog = test_prog.prog + elif sys.argv[1] == "fibonacci": + prog = fibonacci.prog if prog == None: print("error: please specify a valid programm.") - print("valid programms are: test") + print("valid programms are: test, fibonacci") exit() ## start at addres 0x0 |
