1 / 13

COMPILERS CLASS 22/7,23/7

COMPILERS CLASS 22/7,23/7. Introduction. Compiler : A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent program in another language (Target)

lynde
Download Presentation

COMPILERS CLASS 22/7,23/7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMPILERSCLASS 22/7,23/7

  2. Introduction • Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent program in another language (Target) • An important role of the compiler is to report any errors in the source program that it detects during the translation process

  3. Compiler : COMPILER Source code Target code Report error

  4. Target code : Target code is mostly an executable machine-language program. It can be called by the user to process inputs and produce outputs. Target Program Input Output

  5. Memory MDR IR ID MAR PC Control Unit Accumulator R0 R1 ALU R2

  6. Computer Architecture Accumulator: • When a mathematical operation is going on, operator is temporarily stored in Accumulator • Content of memory location and the result is saved or stored through Accumulator

  7. MAR – Memory Address Register MDR – Memory Data Register Memory – Memory Block Read, Write Signals: • MAR reads the data from the Memory block. • MDR writes into the Memory block.

  8. Program Counter : Program Counter contains address of next instruction. Initially it carries address of first instruction. Instruction Memory : All instructions are stored here. IR – Instruction Register ID – Instruction Decoder

  9. ALU – Arithmetic Logic Unit • All the arithmetic operations are performed in ALU • 2 terminals to the Accumulator • 1 terminal to the Registers Control Unit: The control unit coordinates the components of a computer system. It fetches the code of all of the instructions in the program

  10. Example X  [P] + [Q] Instruction Memory Data Memory P,Q – Memory Address P Q R

  11. Steps: • MAR finds the Address • Data goes to MDR (Fetch P,Q) • P,Q stored in Accumulator to registers • Perform Add operation • Result is passed back to accumulator , from accumulator to MDR. Write action is performed and the value is stored in ‘X’

  12. Address of P – 1000 Address of Q – 2000 Address of X – 2050 Solution: LDA 1000 MOV R0 LDA 2000 ADD R0 STA 2050

  13. LDA – Load Data Address MOV – If we don’t use this instruction the value in accumulator will be over written STA – Stores the value in the memory address

More Related