Why no Multiply or Divide function in Little Man Computer

ε祈祈猫儿з 提交于 2020-06-27 16:13:13

问题


Hello I am currently using Little Man Computer for a school project and I understand that LMC has an ADD and a SUB function. However I understand that there is no Multiply or Divide function in LMC and I would like to know why that is.


回答1:


The LMC serves educational purposes, and is not intended to excel in efficiency.

"The Architecture of Computer Hardware and System Software" (4th ed. 2009), chapter 6 is one of the main references for the LMC. That chapter starts with this phrase:

The power of a computer does not arise from complexity.

That is one of the key messages that the LMC aims to bring.

And in section 6.4 Irv Englander writes:

The nine instructions that make up the instruction set that we have presented are sufficient to perform the steps of any computer program, although not necessarily in the most efficient way [...]

The real computer differs mostly in the variations to these instructions that are provided, and with the addition of a few instructions that provide programming convenience, particularly multiplication and division instructions, and also instructions that shift the data in a word left or right.




回答2:


I would imagine that you could use some shifting operators to achieve this, but I don't know for certain if that route is optimal or the only way. Here is a link that I found discussing LMC multiplication: http://www.experts-exchange.com/questions/24104347/Little-Man-Computer-How-to-multiply.html

That link discusses the use of both Add and Sub methods, which can be used to achieve multiplication and division.

As for division it should be noted that computers can't actually do division; they use an inverse of multiplication to do the same thing.



来源:https://stackoverflow.com/questions/34495125/why-no-multiply-or-divide-function-in-little-man-computer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!