XiPU uROM Generator
Instruction Class Reference

This class contains atomic steps for the control unit of defined instruction. More...

#include <instruction.h>

Collaboration diagram for Instruction:
[legend]

Public Types

enum class  Arg {
  None , ABXY , AB , Val256 ,
  Addr
}
 Definitions of the instruction argument types. More...
 
enum class  Flag { Disable , Enable , Any }
 Tristate flag definition for carry and zero control bits. More...
 

Public Member Functions

 Instruction ()
 Default constructor for creating an empty instruction. More...
 
 Instruction (unsigned char opcode, Arg arg0=Arg::None, Arg arg1=Arg::None, Arg arg2=Arg::None, Flag c=Flag::Any, Flag z=Flag::Any)
 
void addStep (const Step &step)
 
unsigned char getOpcode () const
 
Arg getArg0 () const
 
Arg getArg1 () const
 
Arg getArg2 () const
 
Flag getC () const
 
Flag getZ () const
 
const QList< Step > & getStepList () const
 

Private Attributes

unsigned char opcode
 Opcode of defined instruction. More...
 
Arg arg0
 First argument type. More...
 
Arg arg1
 Second argument type. More...
 
Arg arg2
 Third argument type. More...
 
Flag c
 Carry flag accept status. More...
 
Flag z
 Zero flag accept status. More...
 
QList< StepstepList
 Atomic list of steps for the control unit. More...
 

Detailed Description

This class contains atomic steps for the control unit of defined instruction.

Definition at line 20 of file instruction.h.

Member Enumeration Documentation

◆ Arg

enum Instruction::Arg
strong

Definitions of the instruction argument types.

Enumerator
None 

No argument.

ABXY 

Main and auxiliary registers.

AB 

Only main registers.

Val256 

8 bit unsigned value

Addr 

16 bit unsigned address

Definition at line 24 of file instruction.h.

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  };

◆ Flag

enum Instruction::Flag
strong

Tristate flag definition for carry and zero control bits.

Enumerator
Disable 

Only accept the disable value.

Enable 

Only accept the enable value.

Any 

Accept both values.

Definition at line 34 of file instruction.h.

35  {
36  Disable, //!< Only accept the disable value
37  Enable, //!< Only accept the enable value
38  Any //!< Accept both values
39  };

Constructor & Destructor Documentation

◆ Instruction() [1/2]

Instruction::Instruction ( )

Default constructor for creating an empty instruction.

Definition at line 15 of file instruction.cpp.

16 {
17  this->opcode = 0;
18 
19  this->arg0 = Arg::None;
20  this->arg1 = Arg::None;
21  this->arg2 = Arg::None;
22 
23  this->c = Flag::Any;
24  this->z = Flag::Any;
25 }
@ Any
Accept both values.
Arg arg0
First argument type.
Definition: instruction.h:60
@ None
No argument.
Flag c
Carry flag accept status.
Definition: instruction.h:64
Flag z
Zero flag accept status.
Definition: instruction.h:65
unsigned char opcode
Opcode of defined instruction.
Definition: instruction.h:58
Arg arg1
Second argument type.
Definition: instruction.h:61
Arg arg2
Third argument type.
Definition: instruction.h:62

References Any, arg0, arg1, arg2, c, None, opcode, and z.

◆ Instruction() [2/2]

Instruction::Instruction ( unsigned char  opcode,
Arg  arg0 = Arg::None,
Arg  arg1 = Arg::None,
Arg  arg2 = Arg::None,
Flag  c = Flag::Any,
Flag  z = Flag::Any 
)

Constructor using for create an instruction with a defined opcode

Parameters
opcodeOpcode number
arg0First argument type
arg1Second argument type
arg2Third argument type
cWhich status of the carry flag is accepted
zWhich status of the zero flag is accepted

Definition at line 37 of file instruction.cpp.

38 {
39  this->opcode = opcode;
40 
41  this->arg0 = arg0;
42  this->arg1 = arg1;
43  this->arg2 = arg2;
44 
45  this->c = c;
46  this->z = z;
47 }

References arg0, arg1, arg2, c, opcode, and z.

Member Function Documentation

◆ addStep()

void Instruction::addStep ( const Step step)

Add step to the step list of the instruction

Parameters
stepSingle step of the instruction

Definition at line 54 of file instruction.cpp.

55 {
56  this->stepList.append(step);
57 }
QList< Step > stepList
Atomic list of steps for the control unit.
Definition: instruction.h:67

References stepList.

Referenced by URom::URom().

Here is the caller graph for this function:

◆ getArg0()

Instruction::Arg Instruction::getArg0 ( ) const

Get a first argument type of the instruction

Returns
Argument type

Definition at line 74 of file instruction.cpp.

75 {
76  return(this->arg0);
77 }

References arg0.

Referenced by URomData::addInstruction().

Here is the caller graph for this function:

◆ getArg1()

Instruction::Arg Instruction::getArg1 ( ) const

Get a second argument type of the instruction

Returns
Argument type

Definition at line 84 of file instruction.cpp.

85 {
86  return(this->arg1);
87 }

References arg1.

Referenced by URomData::addInstruction().

Here is the caller graph for this function:

◆ getArg2()

Instruction::Arg Instruction::getArg2 ( ) const

Get a third argument type of the instruction

Returns
Argument type

Definition at line 94 of file instruction.cpp.

95 {
96  return(this->arg2);
97 }

References arg2.

◆ getC()

Instruction::Flag Instruction::getC ( ) const

Get a status of accepting the carry flag

Returns
Accepting status of the carry flag

Definition at line 104 of file instruction.cpp.

105 {
106  return(this->c);
107 }

References c.

Referenced by URomData::addInstruction().

Here is the caller graph for this function:

◆ getOpcode()

unsigned char Instruction::getOpcode ( ) const

Get an opcode number of the instruction

Returns
Opcode of the instruction

Definition at line 64 of file instruction.cpp.

65 {
66  return(this->opcode);
67 }

References opcode.

Referenced by URomData::addInstruction().

Here is the caller graph for this function:

◆ getStepList()

const QList< Step > & Instruction::getStepList ( ) const

Get a step list of the instruction

Returns
Step list of the instruction

Definition at line 124 of file instruction.cpp.

125 {
126  return(this->stepList);
127 }

References stepList.

Referenced by URomData::addInstruction().

Here is the caller graph for this function:

◆ getZ()

Instruction::Flag Instruction::getZ ( ) const

Get a status of accepting the zero flag

Returns
Accepting status of the zero flag

Definition at line 114 of file instruction.cpp.

115 {
116  return(this->z);
117 }

References z.

Referenced by URomData::addInstruction().

Here is the caller graph for this function:

Field Documentation

◆ arg0

Arg Instruction::arg0
private

First argument type.

Definition at line 60 of file instruction.h.

Referenced by getArg0(), and Instruction().

◆ arg1

Arg Instruction::arg1
private

Second argument type.

Definition at line 61 of file instruction.h.

Referenced by getArg1(), and Instruction().

◆ arg2

Arg Instruction::arg2
private

Third argument type.

Definition at line 62 of file instruction.h.

Referenced by getArg2(), and Instruction().

◆ c

Flag Instruction::c
private

Carry flag accept status.

Definition at line 64 of file instruction.h.

Referenced by getC(), and Instruction().

◆ opcode

unsigned char Instruction::opcode
private

Opcode of defined instruction.

Definition at line 58 of file instruction.h.

Referenced by getOpcode(), and Instruction().

◆ stepList

QList<Step> Instruction::stepList
private

Atomic list of steps for the control unit.

Definition at line 67 of file instruction.h.

Referenced by addStep(), and getStepList().

◆ z

Flag Instruction::z
private

Zero flag accept status.

Definition at line 65 of file instruction.h.

Referenced by getZ(), and Instruction().


The documentation for this class was generated from the following files: