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

MAXQ揭密

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

子译码3、4和5用作IP寄存器的代理。将递增后的指令指针压栈之后,子译码3加载指令指针,从而实现一个传统的CALL指令。子译码4和5将指定的循环计数器递减后重新加载到循环计数器,并且如果预先递减的循环计数器不为零,则将源操作数也加载到指令指针中。载入目的子译码的源可以是任意形式,例如,指令DJNZ LC[0], A[1]完全有效,该指令会递减LC[0],当递减结果不为零时跳转至A[1]存储的地址位置。

模块14—GR、BP和DPC

模块14包含DPC寄存器、GR寄存器和全部与基址指针和偏移寄存器相关的寄存器(表7)。

表7. 模块14子译码
Sub Function S/D Description
0 @BP[offs] S/D Reads or writes the data memory location pointed to by BP+offs
1 @BP[offs++] S/D If source, reads the data memory location pointed to by BP+offs and then increments offs. If destination, increments offs and then stores the source data at BP+offs.
2 @BP[offs--] S/D If source, reads the data memory location pointed to by BP+offs and then decrements offs. If destination, decrements offs and then stores the source data at BP+offs.
3 offs S/D The 8-bit offset register
4 DPC S/D The data pointer control register defines which data pointer is the current source pointer and the word/byte status of each data pointer.
5 GR S/D The 16-bit general register
6 GRL S/D The low-order byte of the 16-bit general register
7 BP S/D The 16-bit base memory pointer
8 GRS SO The byte-swapped version of the GR
9 GRH S/D The high-order byte of the 16-bit general register
10 GRXL SO The sign-extended low byte of the GR
11 BP[offs] SO The sum of the base pointer and the offset

数据指针控制寄存器(DPC)说明了数据指针是如何发挥作用的。特别地,它为每一个数据指针提供了一个位,用来定义该指针是工作于字模式还是字节模式。它同样包含了一个字段,用于定义哪个指针是当前的源指针。这一点非常必要,因为当源指针被加载后,访问源时只有一条用于操作数的数据总线。

当需要按字节来访问16位数据时,使用GR寄存器就会很方便。只要GR装入了16位数据,就可以分别通过GRL和GRH寄存器提取低字节与高字节。GRS寄存器中包含GR数据字节交换后的结果;GRXL寄存器与GRL寄存器相同,区别仅在于它的高字节是低字节的符号扩展。

基址指针寄存器(BP)是MAXQ架构中三个数据存储器指针寄存器之一,并且只有它支持偏移量寄存器。BP通常指向数据结构的基址,8位无符号偏移寄存器指向该结构的某一个数据单元。注意,该寄存器的递增或递减操作仅仅会修改偏移寄存器,绝不会修改基址寄存器的内容。

模块15—数据指针

模块15包含了MAXQ架构中三个数据指针中的两个。根据子译码的不同,访问这个模块将执行一个直接或间接加载,或者存储操作,并可能在间接访问后递增或递减数据指针。这些寄存器子译码既可以用作源寄存器又可以用作目的寄存器(表8)。

表8. 模块15子译码
Sub Function Description
0 @DP[0] Reads or writes the data memory location pointed to by DP[0].
1 @DP[0]++ If source, reads the data memory location pointed to by DP[0] and then increments DP[0]. If destination, increments DP[0] and then stores the source data at DP[0].
2 @DP[0]-- If source, reads the data memory location pointed to by DP[0] and then decrements DP[0]. If destination, decrements DP[0] and then stores the source data at DP[0].
3 DP[0] Data pointer 0
4 @DP[1] Reads or writes the data memory location pointed to by DP[1]
5 @DP[1]++ If source, reads the data memory location pointed to by DP[1] and then increments DP[1]. If destination, increments DP[1] and then stores the source data at DP[1].
6 @DP[1]-- If source, reads the data memory location pointed to by DP[1] and then decrements DP[1]. If destination, decrements DP[1]. and then stores the source data at DP[1].
7 DP[1] Data pointer 1

模块7—布尔变量操作

借助布尔变量操作(BVM)模块(模块7),允许对典型MAXQ处理器中的许多寄存器进行按位提取和置位/清零(图7)操作。需要注意,并不是所有模块均与BVM模块连接。通常情况下,只有外设模块会与BVM相连;系统寄存器则不会。因此,在BVM与系统寄存器之间传送数据可能产生不可预料的结果。

图7. 模块7的子译码指定了要提取或者替换的位,如果作为源标识符,则表示要加载的立即数位值。
图7. 模块7的子译码指定了要提取或者替换的位,如果作为源标识符,则表示要加载的立即数位值。

作为目的标识符,BVM代理进位功能。源的一位数据被提取并复制到进位中。如果BVM是源标识符,子译码第3位(整个源标识符的第7位)的值将被复制到目的寄存器的指定位中。

需注意,BVM仅仅作用于外设寄存器的第0位至第7位。由于大多数外设寄存器(尤其是I/O端口)仅为8位长度,所以这种工作模式是可以接受的。但如果访问16位外设寄存器,只有低8位是可用的。

模块11—前缀

前缀模块是MAXQ架构独有的特性,它解决了所有16位微控制器共同面临的局限性。由于采用16位寄存器,立即数载入指令需要一个16位的操作数,这意味着一个有效的立即数载入指令需要多于16位的代码。

有几种解决方案来处理这种局限性,比如采用可变长度的指令和寄存器,并允许独立访问低字节和高字节(MAXQ中的GR寄存器就是这样一个例子)。但这些方案都不尽完美,因为它们使得译码逻辑变得非常复杂,或者需要引入新的寄存器(图8)。

图8. 当前缀寄存器作为目的寄存器时,8位立即数源提供16位立即操作数的高字节;目的子译码则为源操作数和目的操作数提供附加位,以寻址每个模块当中的所有32个寄存器。
图8. 当前缀寄存器作为目的寄存器时,8位立即数源提供16位立即操作数的高字节;目的子译码则为源操作数和目的操作数提供附加位,以寻址每个模块当中的所有32个寄存器。

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

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