how does decoder make

Discussion in 'General Electronics Chat' started by vead, Oct 22, 2014.

  1. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    Hello ,

    I am going to make decoder for micro controller , I want to know how does decoder make for microcontroller
    so I made following example just for learning
    I have 4 registers
    I =Instruction Register
    A= Address register
    R1= register R1
    R2 =register R2
    Code (Text):
    1.  
    2. I A R1 R2    out
    3. 0000  0000000000000001
    4.  
    5. 0001  0000000000000010
    6.  
    7. 0010  0000000000000100
    8.  
    9. 0011  0000000000001000
    10.  
    11. 0100  0000000000010000
    12.  
    13. 0101  0000000000100000
    14.  
    15. 0110  0000000001000000
    16.  
    17. 0111  0000000010000000
    18.  
    19. 1000  0000000100000000
    20.  
    21. 1001  0000001000000000
    22.  
    23. 1010  0000010000000000
    24.  
    25. 1011  0000100000000000
    26.  
    27. 1100  0001000000000000
    28.  
    29. 1101  0010000000000000
    30.  
    31. 1110  0100000000000000
    32.  
    33. 1111  1000000000000000
    34.  
    Logic 0= deactivate

    Logic 1= activate



    Output = input

    I A R1 R2 out

    1 1 1 0 1 '' mov R1 '' // I,A R1, activate R2 deactivate

    1 1 0 1 1 '' mov R2 '' // I,A R1, activate R2 deactivate


    1 0 0 1 1 ?

    1 1 0 1 1 ?


    If I know Input then how to decide which function will decode ?
     
    Last edited: Oct 22, 2014
  2. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    3,766
    928
    you have 4 bits used for input. you have 16 bits for output.
    look up/google: 4-16 multiplexer
     
  3. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    I started with small handy example
    4 bit instruction set
    2 bit for opcode and 2 bit for register specification
    Nop 00
    Mov 01
    Add 10
    And 11

    mov data
    Code (Text):
    1.  
    2. Mov R1 01 00
    3. Mov R2 01 01
    4. Mov R3 01 10
    5. Mov R4 11 11
    6.  
    add register to register
    Code (Text):
    1.  
    2. Add R1R2 10 00
    3. Add R1R3 10 01
    4. Add R1R4 10 10
    5. Add R2R4 10 11
    6.  
    and logic
    Code (Text):
    1.  
    2. And R1R2 11 00
    3. And R1R3 11 01
    4. And R1R4 11 10
    5. And R2R4 11 11
    6.  
    nop
    Code (Text):
    1.  
    2. nop  00  00
    3.                 01
    4.                 10
    5.                 11
    6.  
    I want to decode instruction how to decode 16 instruction ?
     
    Last edited: Oct 23, 2014
  4. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    I am using following thing in my processor
    • Program memory address bus -
    • Program memory data bus -
    • Program memory read enable;
    • Register memory address bus -
    • Register memory data bus
    • Register memory read enable;
    • Register memory write enable.
    • address register
    • instruction register
    • data register
    • program counter
    • general purpose register
    look instruction
    Code (Text):
    1.  
    2. ADDRESS              INSTRUCTION     REGISTER        DATA
    3. 01                          MOV                  R1                 DATA
    4. 10                          01                     00                    10
    5.  
    how to fetch decode and execute this one instruction ?
    which register is used to fetch decode and execute instruction ?
     
Loading...