Programmers view

Advertisements
Advertisements
Advertisements3
Advertisements4
Advertisements6
Advertisements66

Programmers view

  • A programmer
  1. writes the program instructions that carryout the desired functionality.
  2. may need not to know detailed information about the processors architecture or operation.
  • Instead may deal with architectural abstraction.
  • The level of abstraction depends on the level of programming.

The Two-levels of programming are

  • Assembly language programming.
  • Structured-language programming.
  • Assembly language programming:- represents processor specific instructions as mnemonics.
  • Structured language programming:- uses processor independent instructions.
  • A compiler automatically translates processor independent instructions into processor specific instructions.

Instruction set

The assembly language programmer must know the processors instruction set.

  • The instruction set describes the bit configurations in IR forms assembly instructions which in turn forms assembly program.
  • Instructions are classified into three categories.
  • Data transfer instructions:- move data between memory and registers, between input-output channels and registers and between registers themselves.
  • Arithmetic Logical instructions:- configure the ALU to carry out a particular function.
  • Channel data from the registers to the ALU, ALU to registers.
  • Branches can be further categorized as being unconditional jumps, conditional jumps or procedure call and return instructions.
  • Unconditional jumps always determine the address of the next instruction.
  • While conditional jumps checks the condition to jump to a particular address.
  • An instruction set has two parts opcode field, operand field.
  • Opcode field:- specifies the operation to take place during the instruction.
  • Operand field:- specifies the location of the actual data that takes part in an operation.
  • Source operands serve as input to the operation, while a destination operand stores the output.
  • The number of operands per instruction varies among processors.
  • The operand field may indicate the data’s location through one of several addressing modes.

 Addressing modes

  • In immediate addressing, the operand field contains the data itself.
  • In register direct addressing, the operand field contains the address of a datapath register in which the data resides.
  • In register-indirect addressing, the operand field contains the address of a register, which in turn contains the address of a memory location in which the data resides.
  • In direct addressing, the operand field contains the address of a memory location in which the data resides.
  • In indirect addressing, the operand field contains the address of a memory location, which in turn contains the address of a memory location in which the data resides.

  • Figure 2.6 shows a (trivial) instruction set with 4 data transfer instructions, 2 arithmetic instructions, and 1 branch instruction, for a hypothetical processor.

  • Figure 2.7(a) shows a program, written in C, that adds the numbers 1 through 10. Figure 2.7(b) shows that same program written in assembly language using the given instruction set.

    Program and data memory space

  • The ES programmer
  1. must be aware of the size of program and data memory.
  2. must check on chip program and data memory.
  • must not exceed program and data memory limits.

    Registers

  • The assembly-language programmer
  1. Must know how many registers are available for data storage.
  2. Must be familiar with registers with special functions.
  • Such registers are used for configuring built-in timers, counters, and serial communication devices.

I/O

  • The programmer
  1. should be aware of the processor’s (I/O).
  2. can read or write a port by reading or writing a special register.
  • One common I/O facility is parallel I/O.
  • Another common I/O facility is a system bus, consists of address and data ports.

Interrupts

  • An interrupt causes the proessor to suspend execution of the main program, jumps to an ISR.
  • The processor stores the current PC, and sets it to the address of the ISR.
  • After executing the ISR control returns to main program by restoring the PC.
  • The programmer
  1. Should be aware of the types of interrupts.
  2. Places each ISR at a specific address in program memory.

 Operating system

  • An operating system is
  1. a layer of software that provides low-level services to the application layer.
  2. decides what program is to run next on the CPU and for how long.
  • It does process/task scheduling.
  1. It services various H/W interrupts.
  2. Implements an environment for management of high-level application programs.
  • A system call is the one for an application to invoke the operating system.
  • operating system generates a predefined software interrupt required by a program.
  • Parameters are typically passed from (to) the application program to (from) the operating system through CPU registers.

 

Author: Lakshmi Prasanna Ponnala

Completed M.Tech in Digital Electronics and Communication Systems.

Leave a Reply

error: Content is protected !!

Discover more from ece4uplp

Subscribe now to keep reading and get access to the full archive.

Continue reading