XiPU uROM Generator
step.h
Go to the documentation of this file.
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
Definition: step.h:24
static const int CODE_1_BUS_C_POSITION
Position of bits for the addressing data bus.
Definition: step.h:30
static const int CODE_FLAG_S_MASK
Mask for ALU_S flags.
Definition: step.h:35
const UCode & getUCode() const
Definition: step.cpp:46
BusAW
Line select defines for the main writing data bus.
Definition: step.h:53
@ ABXY
Main and auxiliary registers.
@ MAH
Memory Address High register.
@ ALU_T
ALU operation.
@ None
Not selected.
@ RPC
Reset Program Counter.
@ PCH
Program Counter High register.
@ SP_PLUS
Increse Stack Pointer.
@ MAL
Memory Address Low register.
@ PC_PLUS
Increse Program Counter.
@ RPC_PLUS
Reset the step counter and increse Program Counter.
@ I
Instruction register.
@ Ram
RAM access.
@ SP_MINUS
Decrese Stack Pointer.
@ OUT
Output register.
@ PCL
Program Counter Low register.
@ D
Hidden data register.
static const int CODE_0_BUS_B_POSITION
Position of bits for the secondary reading data bus.
Definition: step.h:28
static const int CODE_0_BUS_AR_POSITION
Position of bits for the main reading data bus.
Definition: step.h:26
BusB
Line select defines for the secondary reading data bus.
Definition: step.h:74
@ AB
Main registers.
@ D
Hidden data register.
static const int CODE_1_FLAG_S_POSITION
Position of bits for the ALU_S flags.
Definition: step.h:31
Step(BusAR busAR, BusAW busAW, BusB busB=BusB::Default, BusC busC=BusC::Default, unsigned char aluS=0, bool aluM=false, bool aluC=false)
Definition: step.cpp:25
UCode uCode
Parsed microcode for the current step.
Definition: step.h:95
static const int CODE_1_FLAG_M_POSITION
Position of bit for the ALU_M flag.
Definition: step.h:32
static const int CODE_1_FLAG_C_POSITION
Position of bit for the ALU_C flag.
Definition: step.h:33
BusAR
Line select defines for the main reading data bus.
Definition: step.h:39
@ ABXY
Main and auxiliary registers.
@ PCH
Program Counter High register.
@ T
ALU temp register.
@ Flash
FLASH access.
@ IN
Input register.
@ Ram
RAM access.
@ PCL
Program Counter Low register.
@ D
Hidden data register.
BusC
Line select defines for the addressing data bus.
Definition: step.h:82
@ MA
Full 16 bit Memory Address register.
@ SP
Full 16 bit Stack Pointer register.
@ XY
Full 16 bit auxiliary register.
@ PC
Full 16 bit Program Counter register.
static const int CODE_0_BUS_AW_POSITION
Position of bits for the main writing data bus.
Definition: step.h:27
This class contains a parsed microcode of the single step.
Definition: ucode.h:19