• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simulating a computer????

 
fred fredricks
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone. i am really stuck getting started with a exercise i have been set. i really dont understan how to get started. which is always my problem. can some1 help me out, or explain a little how i should approach or get this started? thanks! much appreciated!

http://www.vtr.net/~mwb/simulator/coursework.htm
here is the aim :
For this exercise you need to understand some of the details of a hypothetical computer called FIRST which is a slightly simplified version of the first minicomputer, the DEC PDP-8.
This computer has a single accumulator (ACC), a program counter (PC) and a single bit link register. All registers - except the link register - and memory are 12 bits wide giving a maximum memory size of 212 = 4096 words.
There are 3 types of instructions, all of which occupy 1 word of memory,
�Memory reference instructions - a word in memory is the operand or a word in memory and contents of the accumulator are the operands.
�Accumulator instructions where the only operand is in the accumulator.
�I/O instructions where data is transferred between the accumulator and the I/O device.
In each type of instruction the top three bits - bits 9, 10 and 11 - in the word define the opcode. Three bits allow 8 different instructions to be defined.

thanks again ppl!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,
Pretty tuff assignment there huh? There are probably hundreds of ways to attack this. Here is a skeleton of a class that should get you started:

There is a lot of work to do here. You will have to implement all the empty methods. Also, you will have to come up with an Exception scheme like IllegalProcessorInstructionException, BadAddressException, etc. Good luck and I hope this can get you started.
Michael Morris
 
fred fredricks
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow! ok, thanks....errrr thats a lot of code...darn i didnt know it was that much...but you have made things a bit more "clear" thanks ever so much dude! i will crack on it, see what i can up with...hope you dont mind me asking again if i get stuck...( no doubt i will...LOL)
thanks again
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that this is just a starting point and you will undoubtedly need to add more methods like loadACC(int word), etc. Also, in the DecodedInstruction class, it would probably make more sense to to have a constructor that took a single int. That constructor would then break the int down into instruction, addressing mode and offset. It would also be a good idea to add public static final ints for all the mnemomics in the DecodedInstruction class as well. For example:

Anyway, good luck again and feel free to post any questions on this and I'll try to help.
Michael Morris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!