比較提交
2 個提交
202c903459
...
315602a36f
作者 | SHA1 | 日期 | |
---|---|---|---|
|
315602a36f | ||
|
6085f51211 |
共有 7 個檔案被更改,包括 31 行新增 和 7 行删除
未顯示二進位檔案。
16
README.md
16
README.md
|
@ -1,2 +1,18 @@
|
||||||
# Projet-Systemes-Informatiques
|
# Projet-Systemes-Informatiques
|
||||||
|
**LEJEUNE AURÉLIA - LACROIX RAPHAËL**
|
||||||
|
|
||||||
|
*This project was carried out as part of our computer engineering training.
|
||||||
|
The aim of this project is to design a C compiler and a microprocessor, the former being thought with the latter in mind.*
|
||||||
|
|
||||||
|
The compiler is based on a simplified version of the C language. It supports basic arithmetic operations (addition, subtraction, integer division, multiplication), Boolean operations, while loops and complex conditions. It has been coded using Lex, Yacc and C. The resulting assembly code and object code can be produced using the cross-assembler (itself coded in Python).
|
||||||
|
An interpreter is available in a GUI version to follow assembly code execution step by step in memory.
|
||||||
|
|
||||||
|
## Compilation
|
||||||
|
|
||||||
|
- `$ make vhdl` : compiles and run the compiler then convert its binary into VHDL format
|
||||||
|
- `$ make cli-inter` : compiles and run the compiler then interprets its binary (GUI)
|
||||||
|
- `$ make gui-inter` :compiles and run the compiler then interprets its binary
|
||||||
|
|
||||||
|
## Microprocessor
|
||||||
|
|
||||||
|
The VHDL folder contains all the files needed to build our microprocessor. It also contains two test files, `test_alu` and `test_cpu`, for testing all ALU operations and simulating program execution, respectively.
|
||||||
|
|
|
@ -31,6 +31,9 @@ clean:
|
||||||
vhdl: clean asm
|
vhdl: clean asm
|
||||||
python3 ../cross-Compiler/cross-compiler.py
|
python3 ../cross-Compiler/cross-compiler.py
|
||||||
|
|
||||||
inter: clean asm
|
cli-inter: clean asm
|
||||||
|
python3 ../interpreter/interpreter.py
|
||||||
|
|
||||||
|
gui-inter: clean asm
|
||||||
python3 ../interpreter/graph_interpreter.py
|
python3 ../interpreter/graph_interpreter.py
|
||||||
|
|
||||||
|
|
二進制
compilateur/out
二進制
compilateur/out
未顯示二進位檔案。
|
@ -194,7 +194,7 @@ void checkArraySanity(){
|
||||||
if (currentIndex == maxIndex){
|
if (currentIndex == maxIndex){
|
||||||
reallocateArray(maxIndex * 2);
|
reallocateArray(maxIndex * 2);
|
||||||
} else {
|
} else {
|
||||||
if (currentIndex < maxIndex / 2 && maxIndex / 2 > START_TABLE_SIZE){
|
if (currentIndex < maxIndex / 4 && maxIndex / 4 > START_TABLE_SIZE){
|
||||||
reallocateArray(maxIndex / 2);
|
reallocateArray(maxIndex / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ try:
|
||||||
from textual.containers import Container, VerticalScroll
|
from textual.containers import Container, VerticalScroll
|
||||||
from textual.widgets import Footer, Header, Static
|
from textual.widgets import Footer, Header, Static
|
||||||
except:
|
except:
|
||||||
print("please install textual and rich !")
|
print("\n\n=====================\n\nplease install textual and rich !\n\n=====================\n\n")
|
||||||
|
|
||||||
|
|
||||||
def getLinesToShow(ip, lines):
|
def getLinesToShow(ip, lines):
|
||||||
|
@ -101,7 +101,6 @@ class interpreter(App):
|
||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
"""Compose our UI."""
|
"""Compose our UI."""
|
||||||
path = "./" if len(sys.argv) < 2 else sys.argv[1]
|
|
||||||
yield Header()
|
yield Header()
|
||||||
with Container(id="cont"):
|
with Container(id="cont"):
|
||||||
with VerticalScroll(id="code-view"):
|
with VerticalScroll(id="code-view"):
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
|
|
||||||
|
try:
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.table import Table
|
from rich.table import Tablessdf
|
||||||
|
except:
|
||||||
|
print("\n\n=====================\n\nplease install rich !\n You can also run \"python3 interpreter/interpreter.old.py\" if you want something that does not use any non-core package\n\n=====================\n\n")
|
||||||
|
|
||||||
|
|
||||||
table = Table()
|
table = Table()
|
||||||
|
|
||||||
table.add_column("Operation", justify="left", style="red", no_wrap=True)
|
table.add_column("Operation", justify="left", style="red", no_wrap=True)
|
||||||
|
|
載入中…
新增問題並參考