如何指令从数据区别? [英] How instructions are differentiated from data?

查看:154
本文介绍了如何指令从数据区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读ARM核心文件,我得到了这个疑问。如何在CPU区分数据总线读出​​的数据,是否执行其作为指令或者作为它可以根据操作数据?

While reading ARM core document, I got this doubt. How does the CPU differentiate the read data from data bus, whether to execute it as an instruction or as a data that it can operate upon?

从文档参考节选 -

Refer to the excerpt from the document -

数据进入所述处理器核心
  通过数据总线。该数据可以是
  执行一条指令或数据
  项目。

"Data enters the processor core through the Data bus. The data may be an instruction to execute or a data item."

预先感谢启发我!
/ MS

Thanks in advance for enlightening me! /MS

推荐答案

每个运算code将包括N个字节的指令,然后期待后续的M个字节的数据(内存指针等)。因此CPU使用每个运算code,以确定manyof后面的字节是如何的数据。

Each opcode will consist of an instruction of N bytes, which then expects the subsequent M bytes to be data (memory pointers etc.). So the CPU uses each opcode to determine how manyof the following bytes are data.

当然,对于旧的处理器(例如旧的8位的类型,如6502等)没有区别。您会程序计数器通常指向存储器中的程序的开始,将来自其他地方的存储器引用的数据,但程序/数据存储为简单的8位值。该处理器本身不能区分这两种。

Certainly for old processors (e.g. old 8-bit types such as 6502 and the like) there was no differentiation. You would normally point the program counter to the beginning of the program in memory and that would reference data from somewhere else in memory, but program/data were stored as simple 8-bit values. The processor itself couldn't differentiate between the two.

这是完全有可能指向了什么视为数据的程序计数器,而事实上我记得一个老大学的教程在我的教授做的究竟的是,我们不得不出点错误给他。他的回答是但那是数据!它无法执行!可以吗?,在这一点上,我填写我们的有效运codeS数据来证明,事实上,它可以。

It was perfectly possible to point the program counter at what had deemed as data, and in fact I remember an old college tutorial where my professor did exactly that, and we had to point the mistake out to him. His response was "but that's data! It can't execute that! Can it?", at which point I populated our data with valid opcodes to prove that, indeed, it could.

这篇关于如何指令从数据区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆