电子文章 | 电子资料下载 | 家电维修 | 维修资料下载 | 加入收藏 | 全站地图
您现在所在位置:电子爱好者电子文章嵌入式系统MAXQ揭密

MAXQ揭密

11-20 17:12:16 | http://www.5idzw.com | 嵌入式系统 | 人气:197
标签:嵌入式系统开发,嵌入式开发,http://www.5idzw.com MAXQ揭密,http://www.5idzw.com

注意,对于源寄存器的表示方式并没有限制。它可以是一个立即数,一个间接存储器位置,甚至可以是堆栈中的数值或一个外设寄存器(表4)。

表4. 模块10既作为源寄存器、又作为目的寄存器
Dest Sub SRC Sub Function Description
0 0 MOVE The contents of the accumulator are moved to the accumulator; logically, an NOP. However, the AP register can be changed.
1 CPL The accumulator is complemented bitwise.
2 SLA The accumulator is shifted left one bit; low-order bit is set to zero. High-order bit is copied to carry.
3 SLA2 The accumulator is shifted left two bits; low-order two bits are set to zero. Bit 14 is copied to carry.
4 RL Accumulator is rotated left by one bit, with bit 15 copied to bit 0. Bit 15 is also copied to carry.
5 RLC Accumulator is rotated left by one bit, with bit 15 copied to carry and carry copied to bit 0.
6 SLA4 Accumulator is shifted left four bits; low-order four bits are set to zero. Bit 12 is copied to carry.
7 XCHN The nibbles in each byte of the accumulator are reversed; 0x1234 becomes 0x2143.
8 XCH The bytes of the accumulator are reversed; 0x1234 becomes 0x3412.
9 NEG The accumulator is arithmetically negated.
10 SR The accumulator is shifted right one bit. Bit 15 is loaded with zero. Bit 0 is moved to carry.
11 SRA4 Accumulator is shifted right four bits; high-order four bits are set to zero. Bit 3 is copied to carry.
12 RR Accumulator is rotated right by one bit, with bit 0 copied to bit 15. Bit 0 is also copied to carry.
13 RRC Accumulator is rotated right by one bit, with bit 0 copied to carry and carry copied to bit 15.
14 SRA2 The accumulator is shifted right two bits; high-order two bits are set to zero. Bit 1 copied to carry.
15 SRA The accumulator is shifted right one bit; high-order bit is set to zero. Low-order bit copied to carry.
1 Bit AND C The carry bit is logically ANDed with the designated bit in the accumulator.
2 Bit OR C The carry bit is logically ORed with the designated bit in the accumulator.
3 Bit XOR C The carry bit is logically XORed with the designated bit in the accumulator.
5 0 C ← 0 The carry bit is set to zero.
1 C ← 1 The carry bit is set to one.
2 C ← C The carry bit is complemented.
3 NOP Guaranteed NOP
6 Bit C ← ACC The designated bit in the accumulator is loaded into carry.
7 Bit ACC ← C Carry is loaded into the designated bit in the accumulator.

当源与目的标识符均为模块10时,它或者是一个纯累加器指令,或者是一个包含进位的位操作。在任何情况下,都使用源与目的寄存器来指示特定操作。

目的子译码0指定了所有的纯累加器指令,包括取补码、取反码以及所有移位、循环与交换指令。目的子译码1、2、3、6与7涵盖了按位加载与带进位操作。最终,目的子译码5实现纯进位操作:载入0和1与取补码。

注意,目的子译码5的一个源子译码为指定的NOP指令。在任何情况下,对于既无附加功能又访问空寄存器的操作都会视为NOP操作;MOVE M10[5], M10[3]命令特定用来保证在当前或将来的MAXQ器件中不执行操作。这条指令(0xDA3A)是所有当前汇编程序中的运行代码,用于NOP助记符。

模块12—指令指针
模块12的独特之处在于它包含了一些条件加载操作。如果模块12被用作源模块,只是简单地将IP复制到目的标识符。但如果模块12是目的模块,则除非满足指定的条件,否则不会执行任何操作(表5)。

表5. 模块12子译码
Sub Description
0 If source, load the destination from IP. If destination, load IP from the source.
1 If source, load the destination from IP. If destination, load IP from source only if ACC == 0.
2 If source, load the destination from IP. If destination, load IP from source only if C == 1.
3 If source, load the destination from IP. If destination, load IP from source only if the most recent CMP instruction set the EQ flag.
4 If source, load the destination from IP. If destination, load IP from source only if the high-order bit of the accumulator is set.
5 If source, load the destination from IP. If destination, load IP from source only if ACC == 0.
6 If source, load the destination from IP. If destination, load IP from source only if C == 0.
7 If source, load the destination from IP. If destination, load IP from source only if the most recent CMP instruction cleared the EQ flag.

模块12还有一个独特之处,也就是当加载8位立即数源时,源数值被解释为一个有符号整型数,并加到指令指针中预先递增的数据上。这个加法操作使得相对短跳转更为简单,进而大大节省了代码尺寸。这也同样意味着任意短或长跳转指令都可以是有条件的。

这个模块仅仅支持指令指针寄存器(IP)的简单加载与存储。CALL指令被当作一个可同样加载IP的堆栈指令,而不是作为一个执行压栈的IP指令。因此,CALL指令的传送在堆栈指针模块(模块13)中实现。同样,不存在直接RET指令,它由POP IP所代替。

模块13—堆栈指针

模块13不仅包含与堆栈指针相关的寄存器,还包含循环计数器与中断向量。注意,部分子译码仅仅作为目的时有效。子译码8只在作为源时才有效(表6)。

表6. 模块13子译码
Sub Function S/D Description
0 PUSH/POP S/D If the destination, increment the stack pointer and store the source operand on the stack. If the source, load the value on the stack to the destination and decrement the stack pointer.
1 Stack Pointer S/D Points to the most recently used location on the internal dedicated stack.
2 Interrupt Vector S/D Points to the location in program memory where the interrupt service routine resides.
3 CALL DO Pushes the current IP to the stack, then loads IP from the source operand. Will cause unpredictable results if used as a source operand.
4 DJNZ LC[0] DO Decrements LC[0] and loads IP with the source IF LC[0] != 0. Will cause unpredictable results if used as a source operand.
5 DJNZ LC[1] DO Decrements LC[1] and loads IP with the source IF LC[1] != 0. Will cause unpredictable results if used as a source operand.
6 LC[0] S/D Data is moved to/from loop counter 0.
7 LC[1] S/D Data is moved to/from loop counter 1.
8 POPI SO The value on the stack is copied to the destination, the stack point is decremented, and the IN SERVICE bit is cleared. Primarily used to implement a RETI operation.

上一页  [1] [2] [3] [4] [5]  下一页

,MAXQ揭密
关于《MAXQ揭密》的更多文章