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

Update Acc32.hs #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/Isa/Acc32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ instance Hashable Register
-- | The 'Isa' type represents the instruction set architecture for the Acc32 machine.
-- Each constructor corresponds to a specific instruction.
data Isa w l
= -- | Syntax: @load_imm <value>@ Load an immediate value into the accumulator.
= -- | Syntax: @load_imm <address>@ Load an immediate value into the accumulator.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure? Maybe here it is an value?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm a sure about that. There is usage example:
load_imm buf

Also in the code for load_imm we have:
LoadImm l -> LoadImm (deref' f l)

And the command realisation:
LoadImm a -> setAcc a >> nextPc

So we understand that the command receives the address of the label and loads this address value into the acc, but we can't directly load a value, because of the "deref' f l" instruction.

Maybe it should be like that:
Syntax: @load_imm

@ Load an immediate value of the address into the accumulator.

LoadImm l
| -- | Syntax: @load_addr <address>@ Load a value from a specific address into the accumulator.
LoadAddr l
Expand All @@ -40,25 +40,25 @@ data Isa w l
StoreRel l
| -- | Syntax: @store_ind <address>@ Store the accumulator value into an indirect address.
StoreInd l
| -- | Syntax: @add <value>@ Add a value to the accumulator.
| -- | Syntax: @add <address>@ Add a value from a specific address to the accumulator.
Add l
| -- | Syntax: @sub <value>@ Subtract a value from the accumulator.
| -- | Syntax: @sub <address>@ Subtract from the accumulator a value from a specific address.
Sub l
| -- | Syntax: @mul <value>@ Multiply the accumulator by a value.
| -- | Syntax: @mul <address>@ Multiply the accumulator by a value from a specific address.
Mul l
| -- | Syntax: @div <value>@ Divide the accumulator by a value.
| -- | Syntax: @div <address>@ Divide the accumulator by a value from a specific address.
Div l
| -- | Syntax: @rem <value>@ Compute the remainder of the accumulator divided by a value.
| -- | Syntax: @rem <address>@ Compute the remainder of the accumulator divided by a value from a specific address.
Rem l
| -- | Syntax: @shiftl <bits>@ Shift the accumulator left by a number of bits.
| -- | Syntax: @shiftl <address>@ Shift the accumulator left by a number of bits from a specific address.
ShiftL l
| -- | Syntax: @shiftr <bits>@ Shift the accumulator right by a number of bits.
| -- | Syntax: @shiftr <address>@ Shift the accumulator right by a number of bits from a specific address.
ShiftR l
| -- | Syntax: @and <value>@ Perform a bitwise AND on the accumulator with a value.
| -- | Syntax: @and <address>@ Perform a bitwise AND on the accumulator with a value from a specific address.
And l
| -- | Syntax: @or <value>@ Perform a bitwise OR on the accumulator with a value.
| -- | Syntax: @or <address>@ Perform a bitwise OR on the accumulator with a value from a specific address.
Or l
| -- | Syntax: @xor <value>@ Perform a bitwise XOR on the accumulator with a value.
| -- | Syntax: @xor <address>@ Perform a bitwise XOR on the accumulator with a value from a specific address.
Xor l
| -- | Syntax: @not@ Perform a bitwise NOT on the accumulator.
Not
Expand Down