This repository contains the implementation of an IAS processor simulator. This project includes an assembler to convert assembly code into machine code and a processor simulator to execute the machine code.
Assembler.py
: Converts assembly code into machine code.Processor.py
: Simulates the execution of machine code on the IAS processor.assemblyCode.txt
: Contains the assembly code for testing.machineCode.txt
: Contains the machine code generated by the assembler.cCode.c
: A C program for checking if a number is prime, provided for comparison.
The assembler reads the assembly code from assemblyCode.txt
and converts it into machine code. The machine code is then printed to the console.
To run the assembler:
python Assembler.py
The processor reads the machine code and simulates its execution. It prints the state of various registers after each instruction is executed.
To run the processor:
python Processor.py
The provided assembly code checks if a number is prime. The number to be checked is input by the user when running Processor.py
. The result (0 for not prime, 1 for prime) is printed at the end.