Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add condition instructions #42

Closed
levBagryansky opened this issue Oct 22, 2023 · 4 comments · Fixed by #51
Closed

Add condition instructions #42

levBagryansky opened this issue Oct 22, 2023 · 4 comments · Fixed by #51

Comments

@levBagryansky
Copy link
Member

We should add condition instructions to our ISA

@levBagryansky
Copy link
Member Author

levBagryansky commented Oct 22, 2023

@c71n93
I think the following instructions are necessary here.
All branches are relative.

byte 0 byte 1 byte 2 byte 3 Description
if_icmpeq r1 branchbyte1 branchbyte 2 (long operation) if acc == r1 then branch otherwise just next instr
if_icmpne r1 branchbyte1 branchbyte 2 (long operation) if acc != r1 then branch
if_icmpgt r1 branchbyte1 branchbyte 2 (long operation) if acc > r1 then branch
if_icmpge r1 branchbyte1 branchbyte 2 (long operation) if acc >= r1 then branch
if_icmplt r1 branchbyte1 branchbyte 2 (long operation) if acc < r1 then branch
if_icmple r1 branchbyte1 branchbyte 2 (long operation) if acc <= r1 then branch
if_acmpeq r1 branchbyte1 branchbyte 2 (object ref. operation) if acc == r1 then branch
if_acmpne r1 branchbyte1 branchbyte 2 (object ref. operation) if acc == r1 then branch
dcmpg r1 compare floats acc with r1. Acc became 1 if greater than r1, 0 if equal, otherwise -1
dcmpl r1 compare floats acc with r1. Acc became 1 if less than r1, 0 if equal, otherwise -1
goto imm1 imm2 relative jump by ( (imm1 << 8) | imm2) bytes

We can later add other operations including operations with immidiate.

@c71n93
Copy link
Member

c71n93 commented Oct 22, 2023

@levBagryansky LGTM

@0pdd
Copy link
Collaborator

0pdd commented Nov 1, 2023

@levBagryansky 3 puzzles #52, #53, #54 are still not solved.

@0pdd
Copy link
Collaborator

0pdd commented Feb 19, 2024

@levBagryansky 4 puzzles #52, #53, #82, #83 are still not solved; solved: #54.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants