XiPU uROM Generator
step.cpp
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 #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 }
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
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
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
BusC
Line select defines for the addressing data bus.
Definition: step.h:82
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