Processor Registers

Discussion in 'General Electronics Chat' started by abhimanyu143, Nov 25, 2014.

  1. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    Hello

    I am reading about registers from this page.http://en.wikipedia.org/wiki/Processor_register.I want to know some detail about type of registers. I understand only definition from this page
    Can anybody tell me some example

    Register : register is temporary storage device that is used to store binary Digit

    Type of Register
    Accumulator
    Instruction register
    Data register
    Address register
    Memory data register
    Memory address register

    Accumulator : accumulator is register that store data or result

    Example :LDA ,Register Load Data from register to accumulator
    Register = 0100
    Accumulator =----
    After loading
    Accumulator=register
    0100 = 0100
    STA ,register Store data from register to Accumulator
    Accumulator =0110
    Register =-----
    After storing
    Register =0111

    Instruction register: holding the instruction currently being executed
    Instruction binary data
    LD 0001
    ST 0101
    ADD 0110
    AND 0111

    Data register hold Data
    A=0101
    R=0001

    Address register hold Address
    Memory address register Hold the address of memory

    What are example of Address register, memory address register , memory data register.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    A register is an array of basic devices called flip-flops or latches. When they are used to hold a number they have a most significant bit and a least significant bit. A program inside a processor is executed by a sequence of operations on registers that move data and compute arithmetic results from one or more operands.

    I'm not sure what kind of examples you are looking for. Can you elaborate?
     
    abhimanyu143 likes this.
  3. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    I am not understanding what is Difference between Data register s and memory data registers . they are same or Different
    So that's why I am asking some example about Data register , address register , memory data register and memory address register , to find out how they are different from each other ?
     
  4. Veracohr

    Well-Known Member

    Jan 3, 2011
    549
    75
    It might depend on the system/processor, but you might be able to consider a "data register" to hold data currently being used and a "memory data register" to hold data recently retrieved from memory. An address register holds the location address of a piece of data in memory.

    They're basically all the same, just given different names for the specific kind of numbers they hold.
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    All of the different registers are implemented in the same way. The difference in the names relates to where the data comes from, for the inputs; and where the data from the outputs goes to.
     
    abhimanyu143 likes this.
  6. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    Ok , like this

    registers for code memory
    memory Address register
    Memory Data register

    Instruction register
    0001 hold the 4 bit ADD instruction
    0101 hold the 4 bit AND instruction

    Accumulator Hold data
    01011 data
     
  7. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    In the block diagram attached

    6502 block diagram.PNG

    The block diagram is the inside of 6502 MPU or microprocessor.

    I believe the Address Register is the "PCL" and "PCH"
    and Memory Data Register is "Data Bus Buffer"
    and Memory Address Register is "ABL" and "ABH"

    Allen
     
    abhimanyu143 likes this.
  8. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    thanks to all for giving me important Information
    I saw two link http://en.wikipedia.org/wiki/Register_file
    Register file : register file is array of processor register Inside central processing unit that hold the data and address
    some example :
    data register
    address register
    Instruction register
    program counter
    psw register

    Register bank
    and another link http://www.cpu-world.com/Arch/8048.html
    There are two register bank in this link. register Bank 0 register bank1. each bank has 8 bit registers

    I Don't understand why the microcontroller use register bank. they can use address register, data registers. why they use register bank. what is difference between register file and register Bank
    please someone solve my doubt.
     
  9. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    In any given design, there are limits to how many registers you can directly access. If you need more registers than that, you have to change the design. One common way of doing this is to "bank" the registers somehow. For instance, let's say that you had a simple design that is 8-bits wide. This might limit you to 256 registers. But you might want more than that, so you might use a particular register, say register 12, as a bank select register and whatever value you write to that register would serve as the upper byte in a 16-bit address. Now you could have as many as 65,536 registers in your address space. But this causes problems, too. If you select a bank other than Bank 0, how can you write to the Bank Select Register (register 12) which is in Bank 0? A common approach is to have a small set of registers at the low end of the bank address range only decode the low bits of the address so that they are shared by all the banks. So you might have 16 or 32 registers that are common to all banks and the rest be unique to each bank.
     
  10. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    From above post one thing is cleared for me that I understood what is address registers , data registers, and Instruction Register
    now going to learn more things
    Data memory
    data memory use memory address registers and memory data register
    memory address register - memory address register
    If memory address register is 4 bit and memory address register is 4 bit
    I think code memory should be following
    Data MEMORY 16X4
    Code (Text):
    1.  
    2. Address      Data
    3. 0000           0000
    4. 0001           0000
    5. 0002           0000
    6. 0003           0000
    7. 0004           0000
    8. 0005           0000
    9. 0006           0000
    10. 0007           0000
    11. 0008           0000
    12. 0009           0000
    13. 000A           0000
    14. 000B           0000
    15. 000C           0000
    16. 000D           0000
    17. 000E           0000
    18. 000F           0000
    19.  
    I am not sure. Is it right example ?
     
    Last edited: Nov 26, 2014
  11. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    and also look this Program Memory
    program memory store Instruction , data and Address
    I think I have to use these three registers in Program Memory
    4 bit address , 4 bit instruction , 4 bit data
    Code (Text):
    1.  
    2. Address   Instruction          Data
    3. 0000          xxxx             xxxx
    4. 0001          LD                A
    5. 0002         LD                R1
    6. 0003         ADD               R2
    7. 0004         SUB                A
    8. 0005         ADD               R3
    9. 0006         AND               R1
    10. 0007         LD                R4
    11. 0008        ST                 R5
    12. 0009        NOT                R6
    13. 000A       X-OR                R7
    14. 000B       LD                  R8
    15. 000C       ST                  R9
    16. 000D       ADD                 R10
    17. 000E        LD                 R11
    18. 000F        ST                   A
    19.  
     
  12. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    Yes, that's right .... But I dont think anyone is going to design a mpu with 4 bit address.

    Allen
     
  13. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    In your code, 4 bit instruction + 4 bit data combined is normally called Op-code. After the op-code there is usually an operand which is also 8 bit in width.

    For example, the op-code LD A mean Load Accumulator. But what do you want to load Acc with? The operand can be an immediate data (numeric constant) or a memory Address or even another register Rn. Same case with LD R4 or AND R1. For ST instructions, You have to store the Register to somewhere like a Memory Address. Otherwise the instruction would not make sense.

    Allen
     
    Last edited: Nov 26, 2014
  14. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    you mean like this
    4bit address+ 4 bit instruction + 4 bit destination + 4 bit source (all is 4 bit so I choose 4 bit only for example)

    Code (Text):
    1.  
    2. Address         Instruction     Destination     source
    3. 0000                xxxx             xxxx                      xxxx
    4. 0001                LD                    A                          R1
    5. 0002               LD                    R1                        A
    6. 0003               ADD                 R2                        A  
    7. 0004               SUB                  A                         R4
    8. 0005               ADD                R3                        R5
    9. 0006             AND                  R1                         R2
    10. 0007            LD                      R4                         R3
    11. 0008              ST                     R5                        A  
    12. 0009              NOT                   R6                       R3
    13. 000A           X-OR                   R7                         R2
    14. 000B            LD                       R8                         A
    15. 000C          ST                       R9v                        A
    16. 000D           ADD                  R10                         R2
    17. 000E            LD                       R11                        A
    18. 000F           ST                          A                          R3
    19.  
     
    Last edited: Nov 26, 2014
  15. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    I am just learning, I start to learn with small topics because small thing is always help me lots to understand big things , so I did with small example And I want to continue with this example to learn another topics
    can we do ?
     
    Last edited: Nov 26, 2014
  16. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    A Von Neumann Architecture
    Instruction and data should be same
    example:
    read enable
    Data 4 bit
    instruction 4 bit

    Address instruction operand
    8 bit 4 bit 4 bit


    Harvard Architecture
    Instruction and Data may be different
    Read Enable
    write Enable
    Data bus 4 bit
    Address bus 2 bit

    Address instruction operand
    8 bit 4 bit 2 bit


    How does cpu read program memory

    please someone can point out me with the example
     
    Last edited: Nov 26, 2014
  17. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    I think that the Nand2Tetris project might be something that you would find very informative. I give an overview of it in one of my blogs, so take a look:

    http://forum.allaboutcircuits.com/blog/nand2tetris-overview.590/
     
    abhimanyu143 and absf like this.
  18. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    No, I prefer something like this.....

    Code (Text):
    1.  
    2. Address      Instruction     operand     Comments
    3. ==========================================================================================
    4. 0000         xxxxxxxx        xxxxxxxx
    5. 0001         LDA             #56         ;load A with numeric decimal 56 constant
    6. 0003         LD              R1, A       ;load R1 with contents of A
    7. 0005         ADD             A, R2       ;Add A with R2 and put result in A  
    8. 0007         SUB             A, R4       ;Subtract A with R4 and put result in A
    9. 0009         AND             R2, R5      ;Logical And R2 with R5 and place result in A
    10. 000B         LD              R4, R3      ;load R4 with contents of R3
    11. 000D         ST              R5 , A      ;this instruction can be replaced with LD  
    12. 000F         NOT             R6, R3      ;this instruction is useless
    13. --------------You run out of program memory here-------------------
    14. 0010         XOR             R7, R2      ;where does the result go to?
    15. 0012         ST              R9, $0300   ;store contents of R9 into memory address 0300
    16.  
    Allen
     
    Last edited: Nov 27, 2014
  19. absf

    Senior Member

    Dec 29, 2010
    1,490
    371
    Yes I agreed with WBahn....

    We have given the same advice to "vead" and he didn't bother at all. Otherwise he wouldn't be asking those questions he asked in his posts about mcu design.

    BTW are you perhaps a friend of vead or may be even classmate? He was persuing the same thing as you're asking for the past few months. If you read all the post by member "vead", you will see that he has asked similar questions as to yours. One of his recent posts is here

    http://forum.allaboutcircuits.com/threads/8051-instruction-set.103714/

    Allen
     
    Last edited: Nov 27, 2014
  20. abhimanyu143

    Thread Starter Member

    Aug 25, 2014
    211
    1
    I looked that post. I think he is doing course on embedded system designing. he asked about 8051 microcontroller Design. There is degree course in India. In which we read about embedded micro controller. generally we study about what is processor ROM memory , Ram memory , timer , interrupt i/o device and c programming so may be many student ask about microcontroller I don't think that I can design processor without learning basics. Designing processor is also good but very tough idea
    for my semester exam I have to learn about 8051 , Pic and ARM controller so that's why I am asking
     
Loading...