Wed, 10 Sept 2014, 00:48


A student writes:

> Dear Professor Patt,
>
> I am a CAEP graduate student. I learned a lot in your EE382N.1. But when I
> started the part 2 of the lab1, I come up with a question, why there is no
> MOV instruction in the ISA?
>
> I think MOV is quite convenient for programmers. Without that, we need two
> or more instructions to realize the function depending on whether is it
> from register to memory , register to register or others.
>
> Is this another tradeoff to cancel MOV instruction? If so, without MOV, we
> spend more time on programming and the length of the code is longer,  and
> what we get? Any improvement on efficiency or other?
>
> Thank you!
> <<name withheld to protect the student unhappy there is no MOV instruction.>>

So, I asked him what specifically he had in mind when he said MOV instruction.
He responded:


> I think MOV instruction have many functions.It can move(actually I mean
> copy) data from register to register and memory, from immediate to register
> and memory, and from memory to register.

My follow-up response to him.

You are correct, the MOV instruction (like all instructions) can have many 
functions.  But before we discuss something it is important to know just 
what functions you are talking about.  So, thank you for clarifying what 
*you* mean by MOV instruction.  

Let us examine exactly what you are unhappy about missing:

> It can move(actually I mean copy) data from register to register 

ADD Ra,Rb,#0 does that.


> and memory, 

ST Ra,MEMADDRESS does that.


> from immediate to register 

LD RA,MEMADDRESS can do that if the immediate value is in the program.


> and memory, 

Why would you want to store an immediate in memory during the execution 
of the program?


> and from memory to register.

LD Ra,MEMADDRESS does that.

Do you still see value in including the MOV instruction among the 16 
opcodes I have available to me?

Good luck getting the program done by Sunday night.

Best wishes,
Yale Patt