如何硬件上运行组装? [英] How does hardware run assembly?

查看:125
本文介绍了如何硬件上运行组装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经采取的编译器的课程,并通过自己制作一个基本的,我仍然有关于第一个编译器这个挥之不去的疑问。

Having taken a course on compilers and making a rudimentary one by myself, i still have this lingering doubt about the first compiler.

从高至低的水平,我看到code运行中可以说C或C ++语言被转换到相应的汇编语言相当于用它的编译器(可以说GCC)。这code是依赖于平台(可以说我在英特尔x86架构)。

From a high to low level, i see code running in lets say C or C++ which gets converted to the respective assembly language equivalent by it's compiler (lets say gcc). This code is platform dependent (lets say i'm on intel x86 architecture).

现在问题来了,如何做一个硬件上运行组装?

Now comes the question, how does a hardware run assembly?

我从我的计算机组织类,每一个汇编语句被转换为特定的格式记(具体取决于处理器)例如,像MOV AX声明,BX被转换到它的运算code让说0110 101010 101000.假设汇编解析每条语句在我的汇编语言程序,并将其转换成机器code,那么如何在第一个汇编写的?

I remember from my computer organization class that each and every assembly statement gets converted to a specific format (depending on the processor) for example, a statement like mov ax,bx gets converted to it's opcode let say 0110 101010 101000. Assuming the assembler parses every statement in my assembly language program and converts it into a machine code, then how was the first assembler written?

推荐答案

其实我想你明白。首先标题问题,请问硬件上运行组装。硬件上该机code或机器指令或任何长期运行。正如你所描述正确组装这台机器code的重新presentative,而不是一味但接近一比一的关系类型汇编指令一条机器指令。这是位1和0的硬件现在可以执行的操作,该位描述。

Actually I think you understand. First off the title question, how does hardware run assembly. Hardware runs on machine code or machine instructions or whatever term. As you have correctly described assembly is a representative of that machine code, and not always but is close to a one to one relationship one asm instruction to one machine instruction. These being bits, ones and zeros, the hardware can now perform the actions that the bits describe.

现在怎么会是第一个写的汇编程序?用铅笔和纸。您通常写在某种伪组装的指示,因为你可能不已经完全定义的语言,然后你写下的基础上的编码位,同样的事情的汇编会做。然后使用一些机制,你可以喂这些位插入电脑,并告诉它运行。

Now how is the first assembler written? With pencil and paper. You typically write down the instruction in some sort of pseudo assembly as you may not have completely defined the language, and then you write down the bits based on the encoding, the same thing an assembler would do. Then using some mechanism you feed those bits into the computer and tell it to run.

最后,自然,这让你决定写一个解析语言,更容易编写一个更大的程序成为大型程序的繁琐,然后重复与更复杂的语言和程序。

Eventually, naturally, this becomes tedious for larger programs so you decide to write a larger program that parses a language that is easier to write, then repeat that with more complicated languages and programs.

即使在今天,这取决于球队,他们是如何做的事情和个人的工程师测试指令去coder等手工编写机code仍然发生。最终创建了汇编,并切换到有时还有更高级别的编译器和切换到,对于大部分的编码,但在芯片开发领域仍然是非常清楚的,并不定期将修改在机器code级的指令位。

Even today depending on the team and how they do things and the individual engineer testing the instruction decoder, etc. Writing machine code by hand still happens. Eventually the assembler is created and you switch to that and sometimes there is a higher level compiler and you switch to that for the bulk of the coding, but in the chip development world you still are very aware of and from time to time will modify the bits of an instruction at the machine code level.

这篇关于如何硬件上运行组装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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