| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,98 @@ |
| 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 STEP_H |
|
| 13 |
+#define STEP_H |
|
| 14 |
+ |
|
| 15 |
+#include <QVector> |
|
| 16 |
+ |
|
| 17 |
+#include "ucode.h" |
|
| 18 |
+ |
|
| 19 |
+/** |
|
| 20 |
+ * This class contains a single step of the instruction. |
|
| 21 |
+ * It is a raw describe how to set control lines for the step. |
|
| 22 |
+ */ |
|
| 23 |
+class Step |
|
| 24 |
+{
|
|
| 25 |
+ public: |
|
| 26 |
+ static const int CODE_0_BUS_AR_POSITION = 0; //!< Position of bits for the main reading data bus |
|
| 27 |
+ static const int CODE_0_BUS_AW_POSITION = 3; //!< Position of bits for the main writing data bus |
|
| 28 |
+ static const int CODE_0_BUS_B_POSITION = 7; //!< Position of bits for the secondary reading data bus |
|
| 29 |
+ |
|
| 30 |
+ static const int CODE_1_BUS_C_POSITION = 0; //!< Position of bits for the addressing data bus |
|
| 31 |
+ static const int CODE_1_FLAG_S_POSITION = 2; //!< Position of bits for the ALU_S flags |
|
| 32 |
+ static const int CODE_1_FLAG_M_POSITION = 6; //!< Position of bit for the ALU_M flag |
|
| 33 |
+ static const int CODE_1_FLAG_C_POSITION = 7; //!< Position of bit for the ALU_C flag |
|
| 34 |
+ |
|
| 35 |
+ static const int CODE_FLAG_S_MASK = 0x0f; //!< Mask for ALU_S flags |
|
| 36 |
+ |
|
| 37 |
+ //! Line select defines for the main reading data bus |
|
| 38 |
+ enum class BusAR |
|
| 39 |
+ {
|
|
| 40 |
+ ABXY = 0, //!< Main and auxiliary registers |
|
| 41 |
+ D, //!< Hidden data register |
|
| 42 |
+ IN, //!< Input register |
|
| 43 |
+ T, //!< ALU temp register |
|
| 44 |
+ Ram, //!< RAM access |
|
| 45 |
+ Flash, //!< FLASH access |
|
| 46 |
+ PCL, //!< Program Counter Low register |
|
| 47 |
+ PCH, //!< Program Counter High register |
|
| 48 |
+ Default = 0 |
|
| 49 |
+ }; |
|
| 50 |
+ |
|
| 51 |
+ //! Line select defines for the main writing data bus |
|
| 52 |
+ enum class BusAW |
|
| 53 |
+ {
|
|
| 54 |
+ None = 0, //!< Not selected |
|
| 55 |
+ ABXY, //!< Main and auxiliary registers |
|
| 56 |
+ D, //!< Hidden data register |
|
| 57 |
+ OUT, //!< Output register |
|
| 58 |
+ ALU_T, //!< ALU operation |
|
| 59 |
+ RPC, //!< Reset Program Counter |
|
| 60 |
+ I, //!< Instruction register |
|
| 61 |
+ Ram, //!< RAM access |
|
| 62 |
+ PCL, //!< Program Counter Low register |
|
| 63 |
+ PCH, //!< Program Counter High register |
|
| 64 |
+ MAL, //!< Memory Address Low register |
|
| 65 |
+ MAH, //!< Memory Address High register |
|
| 66 |
+ PC_PLUS, //!< Increse Program Counter |
|
| 67 |
+ SP_PLUS, //!< Increse Stack Pointer |
|
| 68 |
+ SP_MINUS, //!< Decrese Stack Pointer |
|
| 69 |
+ RPC_PLUS //!< Reset the step counter and increse Program Counter |
|
| 70 |
+ }; |
|
| 71 |
+ |
|
| 72 |
+ //! Line select defines for the secondary reading data bus |
|
| 73 |
+ enum class BusB |
|
| 74 |
+ {
|
|
| 75 |
+ AB = 0, //!< Main registers |
|
| 76 |
+ D, //!< Hidden data register |
|
| 77 |
+ Default = 0 |
|
| 78 |
+ }; |
|
| 79 |
+ |
|
| 80 |
+ //! Line select defines for the addressing data bus |
|
| 81 |
+ enum class BusC |
|
| 82 |
+ {
|
|
| 83 |
+ PC = 0, //!< Full 16 bit Program Counter register |
|
| 84 |
+ MA, //!< Full 16 bit Memory Address register |
|
| 85 |
+ SP, //!< Full 16 bit Stack Pointer register |
|
| 86 |
+ XY, //!< Full 16 bit auxiliary register |
|
| 87 |
+ Default = 0 |
|
| 88 |
+ }; |
|
| 89 |
+ |
|
| 90 |
+ Step(BusAR busAR, BusAW busAW, BusB busB = BusB::Default, BusC busC = BusC::Default, unsigned char aluS = 0, bool aluM = false, bool aluC = false); |
|
| 91 |
+ |
|
| 92 |
+ const UCode &getUCode() const; |
|
| 93 |
+ |
|
| 94 |
+ private: |
|
| 95 |
+ UCode uCode; //!< Parsed microcode for the current step |
|
| 96 |
+}; |
|
| 97 |
+ |
|
| 98 |
+#endif |