summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/alu.h18
-rw-r--r--include/archi.h21
-rw-r--r--include/fpu.h6
-rw-r--r--include/interne.h17
-rw-r--r--include/memoire.h6
-rw-r--r--include/registre.h36
6 files changed, 104 insertions, 0 deletions
diff --git a/include/alu.h b/include/alu.h
new file mode 100644
index 0000000..916a626
--- /dev/null
+++ b/include/alu.h
@@ -0,0 +1,18 @@
+#ifndef __ALU_H__
+#define __ALU_H__
+#include "archi.h"
+
+Uint32 AdditionNonSigne(Uint32 a, Uint32 b);
+Uint32 AdditionSigne(Uint32 a, Uint32 b);
+Uint32 SoustractionNonSigne(Uint32 a, Uint32 b);
+Uint32 SoustractionSigne(Uint32 a, Uint32 b);
+Uint32 MultiplicationNonSigne(Uint32 a, Uint32 b);
+Uint32 MultiplicationSigne(Uint32 a, Uint32 b);
+Uint32 DivisionNonSigne(Uint32 a, Uint32 b);
+Uint32 DivisionSigne(Uint32 a, Uint32 b);
+Uint32 AND(Uint32 a, Uint32 b);
+Uint32 OR(Uint32 a, Uint32 b);
+Uint32 SHL(Uint32 a);
+Uint32 SHR(Uint32 a);
+
+#endif \ No newline at end of file
diff --git a/include/archi.h b/include/archi.h
new file mode 100644
index 0000000..2520343
--- /dev/null
+++ b/include/archi.h
@@ -0,0 +1,21 @@
+#ifndef __ARCHI_H__
+#define __ARCHI_H__
+
+#define TAILLE_MEMOIRE 1024 /* Nombre maximum de mots que peut contenir la mémoire principale */
+#define NB_REGISTRES_PHYSIQUES 64 /* Nombre réel de registres */
+#define NB_REGISTRES_UTILISABLES 32 /* Nombre de registres que le processeur a à sa disposition */
+#define REG_RG 32 /* Numero du registre Rg */
+#define REG_RD 33 /* Numero du registre Rd */
+#define REG_PC 34 /* Numero du registre PC */
+#define REG_FLAG 35 /* Numero du registre de flags */
+#define REG_PUSHPOP 36 /* Numero du registre de Push-Pop */
+#define ADD_PP (TAILLE_MEMOIRE-1) /* Emplacement de la pile */
+
+typedef unsigned long int Uint32; /* type d'un mot mémoire (32 bits) */
+
+Uint32 memoire_principale[TAILLE_MEMOIRE];
+Uint32 registre[NB_REGISTRES_PHYSIQUES]; /* Registres classiques */
+Uint32 Err_Mem; /* en cas d'erreur l/e en mémoire principale */
+Uint32 Err_Reg; /* en cas d'erreur l/e dans un registre */
+
+#endif
diff --git a/include/fpu.h b/include/fpu.h
new file mode 100644
index 0000000..b10edfd
--- /dev/null
+++ b/include/fpu.h
@@ -0,0 +1,6 @@
+#ifndef __FPU_H__
+#define __FPU_H__
+#include "archi.h"
+void fpu(Uint32 opcode);
+
+#endif \ No newline at end of file
diff --git a/include/interne.h b/include/interne.h
new file mode 100644
index 0000000..2dac208
--- /dev/null
+++ b/include/interne.h
@@ -0,0 +1,17 @@
+#ifndef __INTERNE_H__
+#define __INTERNE_H__
+#include "archi.h"
+#define VAL_MAX 4294967295
+void Reset(Uint32 * i);
+void Set(Uint32 * i);
+void ResetBit(Uint32 * i, int position);
+void SetBit(Uint32 * i, int position);
+int ValeurBit(Uint32 nombre, int position);
+void Uint32toBin(Uint32 i);
+Uint32 champ(Uint32 nombre, int taille);
+Uint32 Opcode(Uint32 ins);
+Uint32 Extension(Uint32 ins);
+Uint32 Champ1(Uint32 ins);
+Uint32 Champ2(Uint32 ins);
+Uint32 Champ3(Uint32 ins);
+#endif \ No newline at end of file
diff --git a/include/memoire.h b/include/memoire.h
new file mode 100644
index 0000000..2fd8b8b
--- /dev/null
+++ b/include/memoire.h
@@ -0,0 +1,6 @@
+#ifndef __MEMOIRE_H__
+#define __MEMOIRE_H__
+#include "archi.h"
+Uint32 LD(Uint32 offset);
+void ST(Uint32 offset, Uint32 valeur);
+#endif \ No newline at end of file
diff --git a/include/registre.h b/include/registre.h
new file mode 100644
index 0000000..e7b9ff6
--- /dev/null
+++ b/include/registre.h
@@ -0,0 +1,36 @@
+#ifndef __REGISTRE_H__
+#define __REGISTRE_H__
+
+#include "archi.h"
+
+Uint32 LireRegistreRG(void);
+Uint32 LireRegistreRD(void);
+Uint32 LireRegistrePC(void);
+Uint32 LireRegistreFLAG(void);
+Uint32 LireRegistrePP(void);
+
+void EcrireRegistreRG(Uint32 val);
+void EcrireRegistreRD(Uint32 val);
+void EcrireRegistrePC(Uint32 val);
+void EcrireRegistreFLAG(Uint32 val);
+void EcrireRegistrePP(Uint32 val);
+
+Uint32 LireRegistre(Uint32 champ_registre);
+
+void EcrireRegistre(Uint32 champ_registre, Uint32 valeur);
+
+int Overflow(void);
+int Zero(void);
+int Sign(void);
+int Parity(void);
+
+void SetOverflow(void);
+void SetZero(void);
+void SetSign(void);
+void SetParity(void);
+
+void ResetOverflow(void);
+void ResetZero(void);
+void ResetSign(void);
+void ResetParity(void);
+#endif \ No newline at end of file