+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Full Member level 4
    Points: 2,400, Level: 11
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    197
    Helped
    0 / 0
    Points
    2,400
    Level
    11

    instruction set translator

    I am just doing small assignment where in I need to develop 8086 instruction translator on 8051. 8051 reads 8086 op-codes from eprom and executes instructions as though 8086 were present. Any ideas how it can be done.

  2. #2
    Super Moderator
    Points: 82,046, Level: 69
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,458
    Helped
    4488 / 4488
    Points
    82,046
    Level
    69

    Re: instruction set translator

    The hard way I'm afraid. The codes are quite different, including that one is an 8-bit processor and the other is 16-bit.
    You need to read the EPROM byte by byte and use software to look-up the instruction length so you know if it spans several addresses then emulate the full instruction in 8051 code. It is not a trivial task and you will need to create a 'virtual' 8086 model to mimic the operation of a real one. It isn't a 'small' assignment unless you are prepared to limit the instruction set significantly.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 4
    Points: 7,616, Level: 20
    Achievements:
    7 years registered

    Join Date
    Jul 2010
    Location
    Sweden
    Posts
    1,021
    Helped
    388 / 388
    Points
    7,616
    Level
    20

    Re: instruction set translator

    This is probably not a small assignment.

    It is easy for the 8086 to emulate the 8051.
    It is very difficult for the 8051 to emulate the 8086.

    If you already have the EPROM contents, only implement the needed instructions.



  4. #4
    Super Moderator
    Points: 79,246, Level: 68
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,081
    Helped
    3643 / 3643
    Points
    79,246
    Level
    68

    Re: instruction set translator

    Hi,

    and if you not only want to emulate "function" but also "timing", then it becomes even more difficult.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  5. #5
    Full Member level 4
    Points: 2,400, Level: 11
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    197
    Helped
    0 / 0
    Points
    2,400
    Level
    11

    Re: instruction set translator

    I was wondering how emulator works. Commercial emulators claim to emulate variety of processors, how do they achieve timings?



  6. #6
    Super Moderator
    Points: 82,046, Level: 69
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,458
    Helped
    4488 / 4488
    Points
    82,046
    Level
    69

    Re: instruction set translator

    They rely heavily on look-up tables. There will be a table for each instruction that tells it whether it is a single byte or multi-byte (or multi-word) instruction and how many cycles it takes to complete. The virtual processor model 'runs' the program with the cycles taken for each instruction, including possible different number of cycles for conditional instructions is accumulated. Knowing the clock frequency, the timing is calculated based on how many clock cycles per instruction cycle and how many instruction cycles it takes.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  7. #7
    Full Member level 4
    Points: 2,400, Level: 11
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    197
    Helped
    0 / 0
    Points
    2,400
    Level
    11

    Re: instruction set translator

    any small scale reference design available?



    •   AltAdvertisement

        
       

  8. #8
    Full Member level 3
    Points: 1,189, Level: 7
    FlyingDutch's Avatar
    Join Date
    Dec 2017
    Location
    Bydgoszcz - Poland
    Posts
    155
    Helped
    21 / 21
    Points
    1,189
    Level
    7

    Re: instruction set translator




  9. #9
    Super Moderator
    Points: 82,046, Level: 69
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,458
    Helped
    4488 / 4488
    Points
    82,046
    Level
    69

    Re: instruction set translator

    ... but good luck re-writing them to work on an 8051 system!

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  10. #10
    Full Member level 3
    Points: 1,189, Level: 7
    FlyingDutch's Avatar
    Join Date
    Dec 2017
    Location
    Bydgoszcz - Poland
    Posts
    155
    Helped
    21 / 21
    Points
    1,189
    Level
    7

    Re: instruction set translator

    Quote Originally Posted by betwixt View Post
    ... but good luck re-writing them to work on an 8051 system!

    Brian.
    Hello,
    yes you are right :). The assumption to emulate more complicated CPU on smaller and simpler one is bad choice. But you can see how things are done in such examples.

    Best regards



--[[ ]]--