Connect with us

fetching and executing instruction?

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

Scroll to continue with content
  1. vead

    vead

    473
    14
    Nov 27, 2011
    micro controller contain mainly ALU, control unit ROM , RAM, PORT

    Processor take information from ROM, RAM, Input port

    fetching - decoder take command from rom memory

    decode - decoder decode instruction and tell the cpu what to do like add, sub

    execution- alu do the operation like add, sub.. and sand the result into ram memory

    processor take input from the input port

    I have written statement for fetching, decode and execution. Is that correct?
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,272
    Nov 28, 2011
    Yes, I guess so, but that's only a very broad description.

    What are you trying to achieve? Do you want to design your own CPU?

    If so, you should study the architectures of existing small processors such as the PIC, AVR, 8051, etc to learn exactly what they do.
     
  3. shumifan50

    shumifan50

    579
    57
    Jan 16, 2014
    No, you are not even close.
    Very few ALU can directly access memory, they use registers.
    Somewhere needs address bus setup.
    The ALU is the arithmetic unit and is not involved in all instructions.
    So, as I said not even close.
    As I said when you posted before, this can not be described on a forum; it needs a book and very careful reading. And also needs a selection of which architecture you are after - there are several.

    This should be posted on a different forum, unless you need design help with the implementation of a specific bit and have a circuit so far.
     
    Allen Bong likes this.
  4. vead

    vead

    473
    14
    Nov 27, 2011
    I agree, you can't explain whole things and I don't want to someone explain whole things
    but can you give hint its lots for me
    I have many doubts, but at this time the main doubt I have that signal from the input device(switch) goes into the input port

    Q. 1 how does processor know that which port pin is high and which port pin is low ?

    same for output device (LED) signal come from port ?

    Q.2 how does processor send the signal to output port ?
     
  5. shumifan50

    shumifan50

    579
    57
    Jan 16, 2014
    Have you even programmed a MC?

    As far as read/write IO port:
    As I said before, different architectures and implementations handle this differently, some map ports to memory, some map ports to registers, some map ports to registers and the registers into special memory addresses. Some have special IO instructions, some use normal load/store instructions to access IO ports.
    So again, this question is not suitable for asking on a forum.
    In general, when you apply a high signal to a pin of a port and the software uses the appropriate instructions to retrieve the status of the port, the bit representing that port/pin will contain a '1'. If a low signal is applied then it will contain a '0'.
    Ports also behave differently, some are always read/write/enabled, some need to be enabled and set for read or write or any combination.
    Furthermore ports can be digital or analogue inputs/outputs. Analogue ports normally have AD/DA converters so they are presented digitally to the processor..

    I think you should start with a course in programming micro controllers as a lot of it will be explained on such a course. Once you fully understand how to program them, you have a much better chance of understanding the underlying electronics. And note there is a different forum for programming.
     
    Last edited: Mar 31, 2014
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,272
    Nov 28, 2011
    I/O ports are just like memory locations - they are addressed at specific addresses. The hardware detects a read or write access to the particular address, and either provides data onto the data bus (for a read), or latches data from the data bus (for a write).

    Some architectures map ports into the standard data memory space, and some have a separate space that must be accessed by different instructions. The AVR can do both, but that's unusual.

    Edit: I agree with shumifan. If you don't know the answers to these questions, you aren't even close to being able to design your own. Start by studying some existing architectures and learning to program them.
     
    Last edited: Mar 31, 2014
  7. shumifan50

    shumifan50

    579
    57
    Jan 16, 2014
    @Kris: snap
     
  8. vead

    vead

    473
    14
    Nov 27, 2011
    I am not sure but Think signal from the switch (input) goes input port which is addressed any other memory location in Ram memory
    program in rom memory tell the processor to look at location and if the switch is open 0000 the location will hold 0000 data and If switch is closed 0001 location will hold 0001 data


    RAM memory - ROM memory
    location - address data
    R0:8000 - 8000 0000 switch is open
    R1:8006 - 8006 0001 switch is closed
    !
    !
    ! - ! !
    R20 8010 0010

    program contain both data and address in rom memory processor read the memory instruction 8000 0000

    Decoder decode the instruction

    processor do the arithmetic and logic operation

    program tell the processor look at location and If switch is open 0000 the location 8000 will hold data 0000 and If switch is closed the location 8006 hold the data 0001

    program counter execute instruction one by one
     
  9. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,272
    Nov 28, 2011
    vead, I don't understand what you're trying to do. I think I remember a while ago you said you wanted to design a processor core. Is that what you want to do?

    You seem to have the general idea of how to read I/O ports, and how the CPU/MCU core executes instructions.

    You didn't ask any question in your last post, and you haven't responded to shumifan50's and my comment that you should be learning about microprocessor architectures.

    Read some microprocessor and microcontroller data sheets from manufacturers like Intel, Atmel, Microchip, NXP, ON Semiconductor / Motorola, Renesas / Hitachi, Texas Instruments, Freescale, STMicroelectronics, Infineon, etc and learn how they work.

    If that's too advanced, start with some general books on MPU/MCU architecture. Search for microcontroller on amazon.com and buy some books or ebooks.
     
  10. vead

    vead

    473
    14
    Nov 27, 2011
    yes you are correct, I want to design micro controller.
    so I need to know how does microcontroller work (hardware) .

    I am searching on google, I am reading datasheet

    I am confuse lot, I don't understand how the part of conreoller like RAM, ROm , processor work step by step. I want understad how does microcontroller work I have given example look post#8 but I am not sure that I am correct I want to someone checkout my post and tell me where Did I wrong .I will research more sorry for bad english
     
    Last edited: Mar 31, 2014
  11. Harald Kapp

    Harald Kapp Moderator Moderator

    12,315
    2,928
    Nov 17, 2011
    Vead,
    did you read any of the information that has been given to you as links to informative websites, e.g. in this thread of yours?

    You keep posting more or less the same questions in different threads
     
  12. shumifan50

    shumifan50

    579
    57
    Jan 16, 2014
    And YOU don't answer questions:

    Can you and have you programmed a micro controller?

    To try and build a solution to a problem you don't understand is doomed to failure, so you have to be able to program a MC proficiently.

    This is my last comment as you don't do your bit.
     
  13. vead

    vead

    473
    14
    Nov 27, 2011
    I am feeling I have to stop this thread here I have tired I tried lots but could not got the correct answer. i will never post about related this topic on this forum
     
  14. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,505
    2,849
    Jan 21, 2010
    Vead, I am going to try to find you a series of articles describing how to make a computer from discrete components. It is very old, but it goes into detail explaining exactly how the various parts of the CPU interact.

    I can't guarantee I'll be able to find it, but if I do, I want you to promise me you'll read it or I won't bother.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-