I need help to understand circuit

Discussion in 'Homework Help' started by abhimanyu143, Dec 21, 2014.

  1. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    hello,
    I need help to understand this circuit
    as per my knowledge there are three component
    3 to 8 decoder
    2 to 4 decoder
    8 bit instruction register
    look the instruction register. I think first four bit specify opcode ,then two bit specify destination ,and then two bit specify source

    now I want to modify that circuit I want to add accumulator , registers and Ram memory
    how to do , I don't understand how to connect another component ?
     
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    You will need more bits in the register.
     
  3. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    What do you want an accumulator for 4bits or 8bits?
    What do you want the registers for 4bits or 8bits?
    What do you want the Ram memory for 4bits or 8bits or 16bits?
     
  4. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    8 bit accumulator
    8 bit registers
    8 bit Ram memory
     
  5. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    I did not understand what do you mean
     
  6. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    A wider (more bits) instruction word, so that you can include the addressing for the extra source/destinations.
     
  7. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    So referring to 8051 then what will you do?
     
  8. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    ok I am adding more bit
    opcode destination source

    Accumulator may be source or destination
    registers may be source or destination
    ram memory may be source or destination
    Immediate value may be source
    If I include more bit , then instruction word will be following

    opcode ,source (immediate value , accumulator , memory , registers) ,destination ( accumulator , memory , registers)
    three bit opcde , four bit source and three bit destination

    so instruction word length will be 10 bit long.

    look the diagram that I have been posted
    lets think we are using 3 decoder
    3 to 8 decoder that will select operation LD ST , ADD ....
    000 nop
    001 LD
    001 ADD

    2 to 4 decoder for source specification
    00 Immediate value
    01 accumulator
    10 registers
    11 memory

    2 to 4 decoder for destination specification
    00 nop
    01 accumulator
    10 registers
    11 memory

    we can say 7 bit instruction word
    3 bit for opcode
    2 bit for source
    2 bit for destination

    Does it make any sense ?
     
    Last edited: Dec 21, 2014
  9. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Your list just for the decoder, and you still need 1 byte(8 bits) for the accumulator, 1 bytes (8 bits) for the registers, and 1 byte(8 bits) or 2 bytes(16 bits) for the destination(ram address), some others as PC(program counter), IR(instruction register).

    And the others are that you need the 8 bits for the data bus and 1 byte(8 bits) or 2 bytes(16 bits) for the address bus, they depend on that you want to use for 8 bits or 16 bits.
     
  10. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,812
    834
    Are you considering a 10 bit instruction word or 7 bit? A 7 bit instruction word only allows for a total of 3 registers and RAM locations. (One of four possibilities is used for the accumulator). Two RAM locations is all you'd have. Four bits for the source gives you an accumulator and 15 registers/RAM locations. But you only reserve 3 bits for the destination address, hence 8 locations are effectively unusable. Source and Destination address sizes should be the same.
     
  11. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    How you do it depends on your overall architecture. For instance, what address is RAM is to be written to? Is that information supposed to be in the instruction, or is it supposed to be already stored in another register?
     
  12. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    I am just focusing on connection. I made some some diagram so just ignore how many bit for ram , rom , or other . I will answer your question later. just look only for connection
    I don't understand how to connect 1st and 2 nd decoder with registers , accumulator and memory?

    here I have drawn some extra diagram that will help you to understand 1 st diagram
    Instruction word size 8 bit
    Four bit opcode
    Two bit source
    Two bit destination

    Source addressing mode
    00 select accumulator
    01 select registers
    10 select memory
    11 immediate value

    Destination addressing mode
    00 select accumulator
    01 select registers
    10 select memory
    11 nop
    Load immediate data into Accumulator
    LD A, #immediate
    0001 11 00
    0001 Load operation
    11 immediate data (source )
    00 accumulator (destination )

    if I am going on right track then I will tell other example
     
  13. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    Again, how you do things depends on the overall architecture you are working with. Trying to "just look only for connection" is like someone asking how to connect a brake actuator to the brakes but not being willing to consider that how that is done depends on whether the brakes are hand-operated mechanical brakes like on a 10-speed bike, foot-actuated anti-lock hydraulic brakes like on most modern cars, or lever-actuated pneumatic brakes on a locomotive.

    Consider your example to load immediate data into the accumulator.

    What would the instruction be if I want to load the value 3 into the accumulator? What would it be if I want to load the value 42 into the accumulator?
     
  14. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    as you said I tried to make diagram but not sure I don't think that , this will work
     
  15. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    Again, we can't do much for you until you more fully define your instruction set architecture.

    You used the example of loading an immediate into the accumulator. So let's stick to that.

    I have two instructions that appear somewhere in the code:
    LD A, #3
    LD A, #42

    What are the instructions, in binary, for those two assembly code instructions?
     
  16. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Go to study 74LS181, it will help you some more from the very basic.
     
  17. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    How is studying an ALU going to help him understand instruction decoding and memory addressing?

    His basic problem is that he can't articulate what the problem is that he is trying to solve -- and it's hard to solve a problem that you don't understand.
     
  18. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    He just want to creating inside structures of a small CPU, but I want him to looks from outside of the CPU as a block diagram, this is just like when we want to know someone else, maybe we will see how his appearance, and know more about what he like, how he eat, how he study, how he do all the stuff.
     
  19. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    Instruction word size 8 bit
    Four bit opcode
    Two bit source
    Two bit destination

    ooo1 load operation

    Source addressing mode
    00 nope
    01 select registers R1
    10 select registers R2
    11 select registers R3

    Destination addressing mode
    00 Nope
    01 select registers
    10 select memory
    11 select accumulator

    LD A, #3
    LD A, #42
    Instruction word size 8 bit
    Four bit opcode, Two bit source, Two bit destination

    I I I I D D S S
    I I I I D D R R
    0001 1 1 0 1 ; LD A, #3
    0001 1 1 1 0 ; LD A, #42
     
    Last edited: Dec 22, 2014
  20. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    According to your description above:

    0001 11 01 would mean load from R2 to "registers"

    while

    0001 11 10 would mean load from R2 to "memory"

    Do you even see that you are ignoring the immediate value altogether?

    And this is not consistent with your prior description (Post #12) where you said:

    Although I suspect I know where this will go, I would recommend that you work through the first several projects in the Nand2Tetris project described in my blog:

    http://forum.allaboutcircuits.com/blog/nand2tetris-overview.590/
     
Loading...