Added ldrh and ldrc instructions
All checks were successful
Central(Architecture) Docs Build / Build Documentation (push) Successful in 20s

This commit is contained in:
Elyan 2024-11-11 14:38:40 +01:00
parent 90fec87ccb
commit 98ec2dd0f4
8 changed files with 223 additions and 7 deletions

View File

@ -30,6 +30,10 @@ include::instructions/svc.adoc[]
<<<
==== Memory-Related Instructions
include::instructions/ldr.adoc[]
<<<
include::instructions/ldrh.adoc[]
<<<
include::instructions/ldrc.adoc[]
<<<
==== Register Manipulation Instructions

View File

@ -0,0 +1,106 @@
===== LDRC: Load Register Character
[wavedrom, ,svg]
....
{reg: [
{bits: 7, name: 0x3, type: 8, attr: '0x03'},
{bits: 4, name: 'off[3:0]', type: 5},
{bits: 5, name: 'dst', type: 2},
{bits: 5, name: 'src', type: 4},
{bits: 11, name: 'off[14:4]', type: 5}
], config: {label: {right: 'LDRCI'}}}
....
[wavedrom, ,svg]
....
{reg: [
{bits: 7, name: 0x6, type: 8, attr: '0x06'},
{bits: 4, name: 'unused'},
{bits: 5, name: 'dst', type: 2},
{bits: 5, name: 'src', type: 4},
{bits: 5, name: 'off', type: 4},
{bits: 6, name: 'unused'}
], config: {label: {right: 'LDRCR'}}}
....
[frame=ends,grid=rows,cols="1,1"]
|===
|Instruction variant | Description
|LDRCI
|<<LDRCI>>
|LDRCR
|<<LDRCR>>
|===
<<<
[id=LDRCI]
====== LDRCI: Load Character Register+Immediate
Description::
Loads a character (or byte) from memory into a register.
The immediate offset `off` is added to the address in the `src` register before reading memory.
Encoding:: B1-Type
Assembler syntax::
+
[source]
----
ldrc <dst>, [<src>, <off?>]
----
+
Where:
[horizontal]
dst::: Destination register.
src::: Source register.
off:::
Optional offset immediate.
Must be in the range -16384..16383.
If omitted, then 0 is used.
Examples::
+
[source]
----
ldrc r1, [r0] <1>
ldrc r3, [r2, 8] <2>
----
<1> Reads a character from the memory address in r0 into r1.
<2> Reads a character from the memory address in r2, with an 8 bytes offset, into r3.
Privileged instruction:: No.
Updates program state flags:: No.
Exceptions::
MemFault.
<<<
[id=LDRCR]
====== LDRCR: Load Character Register+Register
Description::
Loads a character (or byte) from memory into a register.
The value in the register `off` is added to the address in the `src` register before reading memory.
Encoding:: A1-Type
Assembler syntax::
+
[source]
----
ldrc <dst>, [<src>, <off>]
----
+
Where:
[horizontal]
dst::: Destination register.
src::: Source register.
off::: Offset register.
Examples::
+
[source]
----
ldrc r1, [sp, r0] <1>
----
<1> Reads a character from the memory address in sp into r1, using the value of r0 as an offset.
Privileged instruction:: No.
Updates program state flags:: No.
Exceptions::
MemFault.

View File

@ -0,0 +1,106 @@
===== LDRH: Load Register Halfword
[wavedrom, ,svg]
....
{reg: [
{bits: 7, name: 0x2, type: 8, attr: '0x02'},
{bits: 4, name: 'off[3:0]', type: 5},
{bits: 5, name: 'dst', type: 2},
{bits: 5, name: 'src', type: 4},
{bits: 11, name: 'off[14:4]', type: 5}
], config: {label: {right: 'LDRHI'}}}
....
[wavedrom, ,svg]
....
{reg: [
{bits: 7, name: 0x5, type: 8, attr: '0x05'},
{bits: 4, name: 'unused'},
{bits: 5, name: 'dst', type: 2},
{bits: 5, name: 'src', type: 4},
{bits: 5, name: 'off', type: 4},
{bits: 6, name: 'unused'}
], config: {label: {right: 'LDRHR'}}}
....
[frame=ends,grid=rows,cols="1,1"]
|===
|Instruction variant | Description
|LDRHI
|<<LDRHI>>
|LDRHR
|<<LDRHR>>
|===
<<<
[id=LDRHI]
====== LDRHI: Load Halfword Register+Immediate
Description::
Loads a halfword from memory into a register.
The immediate offset `off` is added to the address in the `src` register before reading memory.
Encoding:: B1-Type
Assembler syntax::
+
[source]
----
ldrh <dst>, [<src>, <off?>]
----
+
Where:
[horizontal]
dst::: Destination register.
src::: Source register.
off:::
Optional offset immediate.
Must be a multiple of 2 and in the range -32768..32766.
If omitted, then 0 is used.
Examples::
+
[source]
----
ldrh r1, [r0] <1>
ldrh r3, [r2, 8] <2>
----
<1> Reads a halfword from the memory address in r0 into r1.
<2> Reads a halfword from the memory address in r2, with an 8 bytes offset, into r3.
Privileged instruction:: No.
Updates program state flags:: No.
Exceptions::
MemFault.
<<<
[id=LDRHR]
====== LDRHR: Load Halfword Register+Register
Description::
Loads a halfword from memory into a register.
The value in the register `off` is added to the address in the `src` register before reading memory.
Encoding:: A1-Type
Assembler syntax::
+
[source]
----
ldrh <dst>, [<src>, <off>]
----
+
Where:
[horizontal]
dst::: Destination register.
src::: Source register.
off::: Offset register.
Examples::
+
[source]
----
ldrh r1, [sp, r0] <1>
----
<1> Reads a halfword from the memory address in sp into r1, using the value of r0 as an offset.
Privileged instruction:: No.
Updates program state flags:: No.
Exceptions::
MemFault.