Help on pipelining

Discussion in 'Programming' started by xuniluser, Aug 5, 2006.

  1. #1
    I need an algorithm that will simulate a processor executing instructions.

    Each instruction is divided into 5 execution parts or stages (IF, ID, EX, MEM, WB)
    Each of these parts or stages should be executed for each clock cycle.

    And for each clock cycle, a new instruction (with the same 5 stages) should be activated and executed in the same manner.
    Time-------------->Cycle1--->Cycle2--->Cycle3--->Cycle4--->Cycle5--->Cycle6
    Instruction1-----> IF--------->ID--------->EX-------->MEM----->WB
    Instruction2------------------->IF--------->ID--------->EX-------->MEM---- >WB

    and so on.

    I suspect I will use Threads on this one but I don't know how?

    Any help?? thanks.
     
    xuniluser, Aug 5, 2006 IP
  2. talentcoder

    talentcoder Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you are simulating a multithreaded processor, you should use create multiple Threads, but if you are just simulating the streamline of those instructions, a single loop can do that.
     
    talentcoder, Aug 11, 2006 IP