The first ARM processors
The ARM-1 processor was an astonishing development, it continued the 6502 ideology (namely to make a processor that is easier, cheaper and better), and was released by Acorn in 1985. This was at the same time when Intel's technological miracle the 80386 processor appeared. ARM consisted of about ten times less transistors
(
Read more... )
Comments 20
There is another exception : using the barrel shifter with a register adds another clock cycle (0 when it is a constant).
RSUB isn't the correct mnemonic for reverse substract, it is RSB
Also your examples should read :
ADD R1, R0, R0,LSL#6
RSB R1, R0, R0,LSL#6
You wrote :
'When calling subprograms, the stack is not used; instead, the return address is stored in the register allocated for it.'
To be more precise, it is R14, but this register is free to use as the other general-purpose registers, when not receiving the return address after a Branch with Link (BL) instruction was used.
The coder can also decide to store the content of R14 somewhere in memory (ex : STR R14,Stored_Return_Address) to free this register and work with it in the sub procedure ...
To come back to the callant routine, one can use MOV PC,R14, but LDR PC,Stored_Return_Address will work too ;-)
Reply
Reply
'Good point, and indeed there's an assembler error which tells you that it can't be done. But if a function isn't as big as 2k, then it can reach a constant just beyond the final return instruction.
'
12 bits allow to address 4095 bytes, and furthermore the encoding of LDR(B) or STR(B) shows that there is a sign bit, outside the 12 bit field. It means from any place in your code, you can reach a value relative to the address of the Program Counter (R15) ranging from -4095 to +4095. So that's an 8kbyte area, not 2 ;-)
Reply
Reply
doesn't use the 13 bit signed terminology.
You can check the LDR(B), STR(B) format in the VL86C010 RISC FAMILY DATA MANUAL, the pdf is easy to find on the net, see on page 28 :
- there is an up/down bit (bit #23) to specify whether the offset is to be added or substracted from base register
- the 12 bit offset is in bits 0 to 11
This 12 bits can hold an unsigned value, but they can also hold a register number and a shift applied to it
(bit #25 determines whether the offset is an immediate value or a possibly shifted register).
Reply
add r8,r7,r7 ;e2 = 2 * err
cmp r8,r4 ;e2 >= dy
to use instead
CMP R4,R7,LSL#1
and change the conditions of the instructions afterwards.
the cmp r8,r3 instruction will become CMP R3,R7,LSL#1 and again you will have to change the conditions of the instructions afterwards.
Reply
Reply
Reply
Reply
Reply
Reply
BTW there is another Zarchos at youtube - https://www.youtube.com/user/zarchos
Reply
Leave a comment