Instruction set need advice?

Discussion in 'General Electronics Chat' started by vead, Mar 19, 2014.

  1. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    I have searched about Instruction set but I am confused I don't know what is concept how they make . I want to understand with example it's just for learning purpose
    I have 2 bit ALU I have 5 instruction Add, Sub, AND , OR NOT . I choose 4 bit instruction word bit I think I need 3 control word bit I think operand will be 2bit because ALU is 2 bit and opcode will be 2 bit
    instruction word bit 4 bit= operand 2 bit+opcode 2 bit

    I am not sure I am going to correct way please help

    how to make instruction set ?
     
  2. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,997
    3,756
    A man once saw a log move down a hill by itself. It moved very quickly and smoothly. He realized that if he cut the log into short sections he could use the round-and-round movement to move other things. He initially just used a row of thinner logs and set his load on top of those segments. After He pushed his load a foot or so, the load would roll off of the last section of log - he then moved that free log to the front of the load and push some more.

    He eventually figured that he could drill a hole in a slice of a fat log and fix the slabs to an axle. When he was just about done with his invention, his wife drove up with a new Honda.
     
  3. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    but why are you telling me this ? tell me if i am wrong. I will study more.
     
    Last edited: Mar 19, 2014
  4. MrChips

    Moderator

    Oct 2, 2009
    12,429
    3,360
    A man saw his friend drive by with a new Honda. He was amazed and fascinated with its sleekness and beauty. So he decided to make one just like it for himself. So he went into the forest to find the perfect tree to carve into his new car. He is lost in the forest and we haven't heard back from him.
     
    GopherT likes this.
  5. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,386
    496
    That's... that's beautiful... that's poetry!
    ☺7
     
  6. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    5 instructions, so you need 3 bit as:

    Code ( (Unknown Language)):
    1.  
    2. b2-b1-b0
    3.  0    0   0
    4.  0    0   1
    5.  0    1   0
    6.  0    1   1
    7.  1    0   0
    8.  x    x    x
    9.  x    x    x
    10.  x    x    x
    11.  
     
  7. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    I know this but what will opcode and operand ?

    operand will be 2bit because ALU is 2 bit and opcode will be 2 bit
    instruction word bit 4 bit= operand 2 bit+opcode 2 bit

    Is it correct ?
     
    Last edited: Mar 20, 2014
  8. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    What is ALU?
    Add, Sub, AND, OR, NOT those are the ALU can do, if the bits of ALU = op code, then op code = 3 bits.
    If you only want to using machine code then it's ok, if you need to using the assembly or C then you have to creating the virtual code as ADD A,B or SUB A,B, etc..., and you also have to write the compiler for assembly and C.
     
  9. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    Instruction word bit divide into OPCODE which specify Instruction type and operand which specify the operation of instruction

    virtual code ADD A,B
    What is A and B I think it is register we can say instruction like ADD , SUB but What is A and B . Is it operand or opcode?
     
  10. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    Did you see the 74HC181?

    Try to read it first.
     
  11. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    I have read datasheet now what I do next ? Instruction set for any controller is very Important we can write code according to instruction set
    Code ( (Unknown Language)):
    1. ORG H
    2. MOV A, #5H
    3. MOV R1, #4H
    4. ADD A,R1
    can you explain what is opcode and operand in programm
     
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    The below is a test1.lst file that it show the opcode and operand.
    opcode - operation code.
    74,79,29 are the opcode.
    5,4 are the operand
    MOV,ADD are the virtual symbol, so they didn't show on the *.lst file.

    Code ( (Unknown Language)):
    1.  
    2. 1   0000                               ORG 0H
    3. 2   0000                    Start:
    4. 3   0000   74 05                MOV A, #5H
    5. 4   0002   79 04                MOV R1, #4H
    6. 5   0004   29                   ADD A,R1
    7. 6   0005                    nop
    8.  
    So you have to understand what the software opcode compare to the hardware 74HC181, you should spend more and more time to see all the structures.

    http://forum.allaboutcircuits.com/attachment.php?attachmentid=66148&stc=1&d=1395317608
     
Loading...