MARIE Skipcond instruction

5,503 views
Skip to first unread message

Ed.R

unread,
Oct 21, 2012, 6:46:27 AM10/21/12
to sjsuc...@googlegroups.com
Hello everyone,

I've been trying to complete the HW4 using the MARIE simulator found on the textbooks website. http://computerscience.jbpub.com/ecoa/3e/

In my version of the textbook I have the following psuedo code for the Skipcond command.

if IR[11-10] = 00 then
    if AC < 0 then PC <- PC+1
else if IR[11-10] = 01 then
   if AC = 0 then PC <- PC+1
else if if IR[11-10] = 10 then
   if AC > 0 then PC <-PC + 1


So when I run the simulator and write my own assembly program I don't get results that are consistent with the textbook. For example my program uses Skipcond 001 and during execution the next instruction is skipped as if AC = 0 but in reality there is a negative integer value in AC. And when I use Skipcond 000 or Skipcond 010 I get equivalent behavior even though they should be exclusive operations.

Has anyone been using the simulator successfully? Is the ISA different in more recent versions of the textbook?

Thanks.

-Eddie

Will Zegers

unread,
Oct 21, 2012, 8:48:02 PM10/21/12
to sjsuc...@googlegroups.com
I was having the same issue trying to code exercise #26 and finally found some clarification online. Looks like the book instructions may be wrong and the skipcond should like

Skipcond 800 if AC > 0, Skipcond 400 if AC = 0, Skipcond 000 if AC < 0

so using "800" instead of "400" finally got my code working right. Hope that helps.

Will

Will Zegers

unread,
Oct 21, 2012, 9:02:01 PM10/21/12
to sjsuc...@googlegroups.com
On a side note: I noticed also that you can put pretty much any number with skipcond and it won't give an assembly error, but when it runs it will just treat it like a NOP. Makes debugging code frustrating if you don't know about it.

Eddie R

unread,
Oct 22, 2012, 1:44:17 AM10/22/12
to willz...@gmail.com, sjsuc...@googlegroups.com
Thanks Will, that really cleared things up!

Frank (sjsu) Lin

unread,
Oct 22, 2012, 1:26:56 PM10/22/12
to eamr...@gmail.com, willz...@gmail.com, sjsuc...@googlegroups.com
very nice collaboration and good work.

zgfn1

unread,
Sep 22, 2013, 2:15:39 AM9/22/13
to sjsuc...@googlegroups.com, willz...@gmail.com
actually, the book is not wrong.
In binary, 
IR[11-10] = 00 means 00xx xxxx xxxx, and you can write 0xx - 3xx in hexdecimal
IR[11-10] = 01 means 01xx xxxx xxxx, and you can write 4xx - 6xx in hexdecimal
IR[11-10] = 10 means 10xx xxxx xxxx, and you can write 8xx - Bxx in hexdecimal
Therefore, we can write Skipcond 000, Skipcond 400, and Skipcond 800.

在 2012年10月22日星期一UTC+11上午11时48分03秒,Will Zegers写道:
Reply all
Reply to author
Forward
0 new messages