You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refer to the last portion here for additional details. Also refer this pdf for details on the instructions.
Decode the instruction
The first two bits of op will determine which family of instructions to execute. 00 corresponds to the Rotate/Shift family of instructions.
The next three bits determine the exact function (010 corresponds to RL & 011 corresponds to RR).
The last three bits determine the register whose value should be checked. The data member register_operands_map (note that it is renamed, no pfx word) of the CPU class can be used for this purpose.
Description
RL: Rotate n left through Carry flag.
RR: Rotate n right through Carry flag.
Flags affected in both cases:
Z - Set if result is zero.
N - Reset.
H - Reset.
C - Contains old bit 7 data.
Create the methods
Follow a similar approach as you did last time!
Files to be edited
CPU.h
ins_prefix.cpp
Read this again!
Again, since everyone is working on the same file simultaneously, we will follow certain conventions to reduce merge conflicts and ensure uniformity in code.
Use only simple nested if-s for decoding. Although not optimal, we can later optimize these and convert them to if-else ladders or switch case statements in another issue. For example:
void PFX()
{
...
if( <check if first two bits correspond to 0b00 for Rotate-Shift family>)
{
...
if(<check for 0b100: SLA> { ... }
...
if(<Add your if condition here>) { ... }
...
}
...
}
Note: Among the above nested, the final one is meant to throw an error to check if SLA (0b100) was not found as that was the only instruction implemented in the last commit. REMOVE THIS IF STATEMENT AND ADD YOURS AT THE END. Also make sure to use the variables already available unless necessary.
Reminders
Add (if) any new data members you create in the private section at the bottom of the CPU.h file. Avoid if not necessary as variables are already available.
Add any new member functions you create along with the other functions similar to them in the header file. For example, define any prefix related functions in the header file in the Prefix Instructions section.
No global/static variables unless there's a very good reason
Add only brief comments to clarify things if the code is not very intuitive or involves tricks, for other cases, try using long descriptive names for the variables instead so comments aren't very necessary.
Use camel case only for type/class/structure names and snake case for everything else.
Proper indentation xD
The text was updated successfully, but these errors were encountered:
Things to be done
Refer to the last portion here for additional details. Also refer this pdf for details on the instructions.
Decode the instruction
op
will determine which family of instructions to execute.00
corresponds to theRotate/Shift
family of instructions.010
corresponds toRL
&011
corresponds toRR
).register_operands_map
(note that it is renamed, no pfx word) of the CPU class can be used for this purpose.Description
RL: Rotate n left through Carry flag.
RR: Rotate n right through Carry flag.
Flags affected in both cases:
Create the methods
Follow a similar approach as you did last time!
Files to be edited
CPU.h
ins_prefix.cpp
Read this again!
Again, since everyone is working on the same file simultaneously, we will follow certain conventions to reduce merge conflicts and ensure uniformity in code.
Note: Among the above nested, the final one is meant to throw an error to check if SLA (0b100) was not found as that was the only instruction implemented in the last commit. REMOVE THIS IF STATEMENT AND ADD YOURS AT THE END. Also make sure to use the variables already available unless necessary.
Reminders
CPU.h
file. Avoid if not necessary as variables are already available.Prefix Instructions
section.The text was updated successfully, but these errors were encountered: