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,49 @@
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
+#include "step.h"
13
+
14
+/**
15
+ * Step constructor
16
+ *
17
+ * @param busAR Which line of the main reading data bus is selected
18
+ * @param busAW Which line of the main writing data bus is selected
19
+ * @param busB Which line of the secondary reading data bus is selected
20
+ * @param busC Which line of the addressing data bus is selected
21
+ * @param aluS Seleted bits for ALU_S flags
22
+ * @param aluM Seleted bit for ALU_M flag
23
+ * @param aluC Seleted bit for ALU_C flag
24
+ */
25
+Step::Step(BusAR busAR, BusAW busAW, BusB busB, BusC busC, unsigned char aluS, bool aluM, bool aluC)
26
+{
27
+	QVector<unsigned char> code = { 0, 0 };
28
+
29
+	code[0] |= (static_cast<unsigned char>(busAR) << CODE_0_BUS_AR_POSITION);
30
+	code[0] |= (static_cast<unsigned char>(busAW) << CODE_0_BUS_AW_POSITION);
31
+	code[0] |= (static_cast<unsigned char>(busB) << CODE_0_BUS_B_POSITION);
32
+
33
+	code[1] |= (static_cast<unsigned char>(busC) << CODE_1_BUS_C_POSITION);
34
+	code[1] |= ((aluS & CODE_FLAG_S_MASK) << CODE_1_FLAG_S_POSITION);
35
+	code[1] |= ((aluM ? 1 : 0) << CODE_1_FLAG_M_POSITION);
36
+	code[1] |= ((aluC ? 1 : 0) << CODE_1_FLAG_C_POSITION);
37
+
38
+	this->uCode = UCode(code[0], code[1]);
39
+}
40
+
41
+/**
42
+ * Get a parsed microcode for the current step
43
+ *
44
+ * @return Parsed microcode
45
+ */
46
+const UCode &Step::getUCode() const
47
+{
48
+	return(this->uCode);
49
+}