CISC 与 RISC
如果您正在编写一本教科书,并且需要决定 CPU 设计来讨论某些问题,您会选择 RISC 还是 CISC? RISC 的优点,你知道的:更干净、更简单等等。 RISC 的缺点:我必须使用模拟器,与 x86 相比,市场上的 CPU 很少,因此比我选择 ARM 或 SPARC 等纯 RISC CPU 的影响更小。尽管我倾向于 x86 和 CISC,但我很困惑……许多优点,缺点:不是 RISC,以及所有像 Henessy 等人的书。还有其他人喜欢 RISC!所以,总而言之:您会选择 RISC 还是 CISC (x86)? 谢谢。
If you were writing a a textbook, and you needed to decide on a CPU design to talk about certain issues, would you choose RISC or CISC? Pros for RISC, well, you know: cleaner, easier, and so on. Cons for RISC: I would have to use an emulator, few CPUs in market, compared to x86 , and therefore less impact than if I chose a pure RISC CPU like ARM or SPARC. I'm torn, though I am leaning towards x86 and CISC... many pros, cons: not RISC, and all those books like Henessy et al. and others love RISC! So, in summary: would you choose RISC or CISC (x86)?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是在专门谈论 x86 处理器设计,还是在 x86 中比其他任何东西都更普遍的特定设计功能?不?然后采用 RISC 架构。
使用 x86 所能实现的只是 x86 机制会掩盖你真正想要表达的任何观点。
Are you talking specifically about x86 processor design, or a specific design feature which is more prevalent in x86 than anything else? No? Then go with a RISC architecture.
All that using x86 will achieve is that the x86 mechanics will obscure whatever point it is you're actually trying to make.
对于一般(或程序员)受众,我建议使用x86。无论他们熟悉哪种语言,都可以使用 x86 轻松演示 for 和 if 等相同的构建块,或函数的概念指示。
Asm 足够抽象,如果他们能够将新知识与他们现有的编程理解联系起来,那就是无价的。 (它甚至可以帮助他们编写质量更高的代码)。
我不认为选择 x86 意味着您必须包含所有指令。下一个级别可以是引入某些 ASM 结构的机器代码表示,但前提是它们首先适合其助记符。
Fory general (or programmer) audiences I would suggest x86. No matter what language they are familiar with, the same building blocks like for and if, or the concept of functions can be easily demonstrated with x86 instructions.
Asm is abstract enough, it is priceless if they can connect the new knowledge to their existing understanding of programming. (It may even help them write better quality code).
I don't think choosing x86 means that you have to include all the instructions. The next level can be that you intoduce the machine code representation of some ASM structures, but only when they are confortable with their mnemonics first.
我更喜欢 RISC,因为它们具有快速和小指令。它们比 CISC 的便宜,并且拥有更多的寄存器。以及CISC处理器的一些指令,例如intel的
xchg
或scas
、stos
、movs
和cmps与
非常特殊,以至于许多编译器从不使用它们,因此拥有它们只是浪费芯片和金钱。rep
一起使用的而且,谈到寄存器,即使 RISC 处理器需要更多指令来完成 CISC 仅用一条指令就能完成的任务,它们也有如此多的寄存器,以至于(我认为)在 RISC 上访问内存的频率较低。
我是作为一名 CISC“程序员”来谈论的,因为我学习了 intel 的 x86,有时只有 6 个可用的通用寄存器,这些寄存器通常在循环中减少到 3 或 4 个(ecx 消失了,使用 edi 或 esi 或两者都使用) ),可能非常棘手。
尽管汇编本身往往隐藏了代码的真实本质,但我认为(记得我是在 x86 上成长的)RISC 汇编由于需要大量指令而更难理解。
I prefer RISC, because they have fast and small instructions. They're cheaper than CISCs ones and have many more registers. And some instructions of CISC processors, for example intel's
xchg
orscas
,stos
,movs
andcmps
used withrep
are so particular than many compilers never use them, so having them is only a waste of silicon and money.And, talking about registers, even if RISC processors need more instructions to accomplish what a CISC would do with only one, they have so many registers that (I think) memory is accessed less frequently on a RISC.
I'm talking as a CISC "programmer", since I learned on the intel's x86 and sometimes having only 6 general purpose registers available, which are often reduced to 3 or 4 in loops (ecx is gone, with either edi or esi or both), can be very tricky.
Although assembly itself tends to hide the true nature of the code, I think (remember I grew with the x86) that the RISC assembly is more difficult to understand due to the larger amount of instruction needed.
如果一个项目的主要需求是安全性,而不是容量,因为安全性往往是容量的权衡,那么我建议使用RISC架构。例如,使用 x86 汇编器的防火墙存在安全问题,而 SPARC 汇编器等 RISC 实现则没有。因此,最安全项目的规范可能是使用 SPARC 程序集,因为众所周知,它是一个安全的环境,即使不知道它是一个安全的环境,与 x86 程序集相比,能够对 SPARC 程序集进行编程的人也很少因此,如果防火墙运行的是 RISC 架构,则能够编写安全漏洞的攻击者数量将会减少。
所以我说如果你谈论的是防火墙应用程序,那么可能它应该是RISC架构。
If the main requirement for a project is security, not capacity since security often is a tradeoff for capacity, then I propose that the RISC architecture is used. A firewall that for instance uses x86 assembler was known to have a security issue that RISC implementation like SPARC assembler didn't. So the spec for the most secure project could be to use SPARC assembly since it is known to be a secure environment and even if it wasn't known to be a secure environment there are so few people who can program SPARC assembly compared to x86 assembly so the number of attackers who could program a security breach would be less if what a Firewall is running is a RISC architecture.
So I say that if you are talking about a firewall application, then probably it should be a RISC architecture.