algosup / 2023-2024-project-3-virtual-processor-team-4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Project

This project is a student project provided by ALGOSUP, based in Vierzon. ( → see the call for tender) The objective is to build a virtual processor and its components in C and to create our assembly language to interact with it.

The definition of the project is available in the Project Charter


The Members

Name Role Image Link
Benoît DE KEYN Project Manager Benoît's Github Profile
Léo CHARTIER Program Manager Léo's Github Profile
Jason GROSSO Tech Lead Jason's Github Profile
Antoine PREVOST Software Engineer Antoine's Github Profile
Max BERNARD Software Engineer Max's Github Profile
Maxime THIZEAU Quality Assurance Maxime's Github Profile

The Manual

Download

Just download the code of the project from the last release or directly the zip of the main code. Then, unzip it, and follow the instructions below ↓

Content of the release

In the release, the folder named 'src' contains all the code of the project. You can find here the libraries folder and three files.c :

  • assembler.c : program reading an assembly file (.asm) to generate a machine code file (.bin)
  • emulator.c : program reading the machine code file (.bin) to execute the instructions through the virtual processor.
  • test_emulator.c : a test file which runs tests on all the emulator functions.
  • libs/
    • utils.h : structures and tools used in both emulator and assembler programs
    • clock.h : !not used! functions relative to the clock implementation to have a regular execution of the instructions.
    • preprocessor.h : functions relatives to the reading of the assembly file, detecting synthetical and semantical errors: decode the .asm file and gives all the read instructions to the assembler part.
    • assembler.h : functions relatives to the encoding part . It take the instructions given by the preprocessor, to build the machine code (.bin) file containing all the instructions in binary.
    • v_components.h : functions to allocate the space in memory and create files that emulate the virtual component of the virtual processor architecture. It contains also the reading, writing and printing functions of the components' content.
    • v_instructions.h : functions which execute the assembly instructions using the virtual components.

How to run an assembly file

The prerequisite is a compilator to compile .c files to executable files. We used gcc compiler for the entire project. So you have to refer to an online tutorial to install gcc on your machine.

Windows

You first need to have your program in assembly. Examples of assembly files are available here and the documentation for our assembly language an₫ processor architecture are available in the functional folder of the GitHub repository).

Open a terminal, and place you in the folder 'src' cd "C:/Users/.../src"

Compile assembler.c : gcc assembler.c -o assembler

Compile emulator.c : gcc emulator.c -o emulator

Run the assembler with your assembly file: assembler.exe path_to_your_file.asm Here the .bin file will be created in the same folder as the .asm file. OR assembler.exe path_to_your_file.asm path_to_your_destination_folder Here the .bin file will be created in the destination folder.

Run the emulator with the generated machine code file: emulator.exe path_to_your_file.bin However, as there is no way to see print in the terminal with the assembly code, you can use the following command to see the content of the registers at the end of the execution: emulator.exe -d path_to_your_file.bin //execute the machine code and then print the registers through the 'debug' option.

Linux

Adapt the command to place you in the right folder and then, adapt the code above replacing '.exe' extensions with '.o' extension

MacOS

Adapt the command to place you in the right folder and then, adapt the code above replacing xxx.exe with ./xxx to execute the executable


Related documents


Dates

  • We started the project on Wednesday, January 17th, 2024

  • The deadline for the project is Friday, February 23rd

  • Date of the last official update of the project: 23/02/2024


License

This project is under the MIT License.


About

License:MIT License


Languages

Language:C 97.4%Language:Assembly 2.6%