Browse code

Add source code of the uROM generator

Pawel Jablonski authored on 24/01/2021 21:45:08
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+/*
2
+ * Author: Pawel Jablonski
3
+ * E-mail: pj@xirx.net
4
+ * WWW: xirx.net
5
+ * GIT: git.xirx.net
6
+ *
7
+ * License: You can use this code however you like
8
+ * but leave information about the original author.
9
+ * Code is free for non-commercial and commercial use.
10
+ */
11
+
12
+#ifndef UROMDATA_H
13
+#define UROMDATA_H
14
+
15
+#include <QString>
16
+#include <QFile>
17
+#include <QVector>
18
+
19
+#include "instruction.h"
20
+
21
+//! This class contains a whole generated microcode for all instructions
22
+class URomData
23
+{
24
+	public:
25
+		static const int INSTRUCTION_QUANTITY = 256; //!< Support only for 256 opcodes
26
+		static const int INSTRUCTION_CYCLE_QUANTITY = 16; //!< Every instruction can get only 16 steps
27
+
28
+		static const int ADDRESS_FLAG_C_POSITION = 12; //!< Position of the carry bit received from ALU to the control unit
29
+		static const int ADDRESS_FLAG_Z_POSITION = 13; //!< Position of the zero bit received from ALU to the control unit
30
+
31
+		static const int UROM_SIZE = 32768; //!< uROM size for low and high banks
32
+
33
+		URomData();
34
+
35
+		void addInstruction(const Instruction &instruction);
36
+		bool saveFiles(const QString &urom0Path, const QString &urom1Path);
37
+
38
+	private:
39
+		//! Data container for low and high banks
40
+		QVector<QVector<unsigned char>> data = { QVector<unsigned char>(UROM_SIZE), QVector<unsigned char>(UROM_SIZE) };
41
+};
42
+
43
+#endif