XiPU uROM Generator
instruction.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 INSTRUCTION_H
13 #define INSTRUCTION_H
14 
15 #include <QList>
16 
17 #include "step.h"
18 
19 //! This class contains atomic steps for the control unit of defined instruction
21 {
22  public:
23  //! Definitions of the instruction argument types
24  enum class Arg
25  {
26  None, //!< No argument
27  ABXY, //!< Main and auxiliary registers
28  AB, //!< Only main registers
29  Val256, //!< 8 bit unsigned value
30  Addr //!< 16 bit unsigned address
31  };
32 
33  //! Tristate flag definition for carry and zero control bits
34  enum class Flag
35  {
36  Disable, //!< Only accept the disable value
37  Enable, //!< Only accept the enable value
38  Any //!< Accept both values
39  };
40 
41  Instruction();
43 
44  void addStep(const Step &step);
45 
46  unsigned char getOpcode() const;
47 
48  Arg getArg0() const;
49  Arg getArg1() const;
50  Arg getArg2() const;
51 
52  Flag getC() const;
53  Flag getZ() const;
54 
55  const QList<Step> &getStepList() const;
56 
57  private:
58  unsigned char opcode; //!< Opcode of defined instruction
59 
60  Arg arg0; //!< First argument type
61  Arg arg1; //!< Second argument type
62  Arg arg2; //!< Third argument type
63 
64  Flag c; //!< Carry flag accept status
65  Flag z; //!< Zero flag accept status
66 
67  QList<Step> stepList; //!< Atomic list of steps for the control unit
68 };
69 
70 #endif
This class contains atomic steps for the control unit of defined instruction.
Definition: instruction.h:21
Flag
Tristate flag definition for carry and zero control bits.
Definition: instruction.h:35
@ Enable
Only accept the enable value.
@ Disable
Only accept the disable value.
@ Any
Accept both values.
Arg arg0
First argument type.
Definition: instruction.h:60
Arg getArg0() const
Definition: instruction.cpp:74
Arg
Definitions of the instruction argument types.
Definition: instruction.h:25
@ ABXY
Main and auxiliary registers.
@ Addr
16 bit unsigned address
@ None
No argument.
@ AB
Only main registers.
@ Val256
8 bit unsigned value
Arg getArg2() const
Definition: instruction.cpp:94
Flag getZ() const
void addStep(const Step &step)
Definition: instruction.cpp:54
Flag c
Carry flag accept status.
Definition: instruction.h:64
Flag z
Zero flag accept status.
Definition: instruction.h:65
unsigned char getOpcode() const
Definition: instruction.cpp:64
Arg getArg1() const
Definition: instruction.cpp:84
QList< Step > stepList
Atomic list of steps for the control unit.
Definition: instruction.h:67
unsigned char opcode
Opcode of defined instruction.
Definition: instruction.h:58
const QList< Step > & getStepList() const
Arg arg1
Second argument type.
Definition: instruction.h:61
Instruction()
Default constructor for creating an empty instruction.
Definition: instruction.cpp:15
Flag getC() const
Arg arg2
Third argument type.
Definition: instruction.h:62
Definition: step.h:24