cpu arch之risc, cisc ,von-neumann,harvard ,modified harvard

risc设计规范
The best way to understand RISC is to treat it as a concept to design processors. Although
initial RISC processors had fewer instructions compared to their CISC counterparts, the
new generation of RISC processors has hundreds of instructions, some of which are as
complex as the CISC instructions. It could be argued that such systems are really hybrids
of CISC and RISC. In any case, there are certain principles that most RISC designs follow.
We identify the important ones in this section.

1.简单的运算
目的是设计简单的能在单周期执行的指令。Note that a cycle is defined as the time required to
fetch two operands from registers, perform an operation, and store the result in a register
2.寄存器到寄存器的操作
A typical CISC instruction set supports register-to-register operations as well as registerto-memory and memory-to-memory operations. The IA-32, for instance, allows registerto-register as well as register-to-memory operations; it does not allow memory-to-memory
operations
risc处理器只允许load和store指令访问ram
3.简单的寻址方式
Simple addressing modes allow fast address computation of operands. Because RISC
processors employ register-to-register instructions, most instructions use register-based
addressing. Only the load and store instructions need a memory-addressing mode.
risc处理器提供很少的寻址方式,一般1-2种,比如mips,powerpc(arm比较特殊,9种)
4.大量的寄存器组
RISC processors use register-to-register operations, therefore we need to have a large
number of registers. A large register set can provide ample opportunities for the com-
piler to optimize their usage. Another advantage with a large register set is that we can
minimize the overhead associated with procedure calls and returns.
arm有15个寄存器r0-r14和pc.但加上各种模式下的寄存器和状态寄存器共计37个。
mips提供32个寄存器
5.固定长度的简单指令格式
RISC designs use fixed-length instructions. Variable-length instructions can cause implementation and execution inefficiencies

cisc起源
As the name suggests, CISC systems use complex instructions. What is a complex
instruction? For example, adding two integers is considered a simple instruction. But, an
instruction that copies an element from one array to another and automatically updates
both array subscripts is considered a complex instruction. RISC systems use only simple
instructions. Furthermore, RISC systems assume that the required operands are in the
processor’s internal registers, not in the main memory. We discuss processor registers in
the next chapter. For now, think of them as scratchpads inside the processor.

CISC设计不采取risc的限制措施。而事实证明,risc 简单的指令和限制,如基于寄存器操作数的特征,不仅
简化了处理器的设计,还使处理器应用性能得以提高(解释一下,现在x86 cisc性能比arm risc强大n倍,但是原文就是这么说的。原文是:It turns out that characteristics like simple instructions and restrictions like register-based operands not only
simplify the processor design but also result in a processor that provides improved application performance)。

为什么早期设计者没有想到RISC处理器设计方式?
Several factors contributed to the popularity of CISC in the 1970s
In those days,
memory was very expensive and small in capacity. For example, even in the mid-1970s,
the price of a small 16 KB memory was about $500. You can imagine the cost of memory
in the 1950s and 1960s
So there was a need to minimize the amount of memory required
to store a program.
An implication of this requirement is that each processor instruction
must do more, leading to complex instruction set designs.


cisc处理器要处理复杂指令,电路复杂,体积大,功耗高。

von-neumann




harvard arch


modified harvard
内部是哈佛,外部是诺依曼,称改进的哈佛结构。

见于arm9,arm11,cortex-a系列,

下面一种也是harvard ,是8051的架构


顺便说一下普通8位单片机比如c51和arm如arm9执行程序的区别,
arm9内部配置有cache,两个,指令和数据。51单片机内部没配置cache。为便于比较执行过程,假设arm9的cache关掉了。
对于arm9,一般会搭配64MB sdram,所以程序可以完全被载入到sdram中。
如果arm9从nand启动,启动之后,需要先把nandflash中的程序(uboot,linux)载入sdram,然后从sdram中取出指令执行之(具体过程是,nand控制器自动先把nand的前4KB代码复制到4kb的ram中,这个ram中的代码负责把nand中其他代码考到sdram,然后从sdram执行)。此时sdram也被划分出来一部分被当做数据存储器,存放临时的变量值。
如果从norflash启动,则cpu从norflash的0地址取代码执行。此时,sdram被当做数据存储器,存放临时的变量值。

对于89c51,片内自带4KB flash和256Bram,单片机启动时,从flash的0地址拿出代码执行之。ram被当做数据存储器,存放临时的变量值。

可见,如果arm9从norflash启动,跟普通的单片机执行原理是一样的。但arm9毕竟速度快,从flash中取数据太慢,拖cpu后腿。所以现在norflash在arm上基本无用武之地了,直接使用nandflash保存代码和使用sdram执行代码(norflash既能保存代码也能执行---由于访问方式和ram一致,所以能直接执行,但是速度慢)。

但是norflash中可以放个其他的调试程序,比如某个好用的boot程序,需要时从norflash启动来调试一些东东也是可以的。

还有一点,关于数据存储器的几个问题:
51的数据存储器中保存的是什么东西?全局变量个局部变量是怎么保存到?和arm有什么区别?
比如8051单片机,其数据存储器是256字节,其中有部分用于保存程序执行期间产生的临时结果。比如保存局部变量的值。全局变量也会在数据存储器中分配一个固定的地址,并且整个程序周期都不会被释放。

而arm9的linux下的应用程序的的代码保存在sdram的代码段,全局变量保存在sdram的
refer to
Guide To RISC Processors - For Programmers And Engineers (2004)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值