Thread: PROGRAM FOR PC(PROGRAM COUNTER) experienced programer please look

  1. #1
    Registered User
    Join Date
    Aug 2004

    PROGRAM FOR PC(PROGRAM COUNTER) experienced programer please look

    ive got a problem i have to write a code to implement a PC but im not really sure where to get started ,its one of my questions on my practice exam and i cant seem to figure it out.. can someone please give me some tips on how to go along with it or if someone has a example of one... thanks

    write a C progam that implements the program counter of a MIPS mico processor to access a BYTE wide array of main memory and retrive a 32 bit wide instruction. Adapt your program so that the program counter can deal with jumps to and return from process(ie alter the contents of PC)

  2. #2
    Registered User
    Join Date
    Sep 2004
    Well the PC is just going to be an integer which is increased by 4 every instruction. For each count, you need to take the integer value stored in the PC, and use it as an address. Access that address in memory, and extract 32 bits of machine code. Execute the machine code, increment the PC by 4, and repeat. Simple

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Line Counter program
    By siavoshkc in forum A Brief History of
    Replies: 1
    Last Post: 07-21-2006, 11:49 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. Last program!!
    By buckwheat88 in forum C++ Programming
    Replies: 12
    Last Post: 01-17-2006, 12:31 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM