Wednesday, June 8, 2011

3.3 Operands of the Computer Hardware

  • Unlike high-level languages, the operands of arithmetic instruction cannot be any variables, they must be from a limited number of special locations called registers
  • Registers are the bricks of computer construction, for registers are primitives used in hardware design that are also visible to the programmer when the computer is completed
  • 32 bits are named word in MIPS architecture (32 bit)
  • One major difference between the variables of a programming language and registers is the limited number of registers, typically 32. (MIPS has 32 registers)
  • A very large number of registers would increase clock cycle time simply because it takes electronic signals longer when they must travel farther
  • MIPS convention is to use two character name following a dollar sign to represent a register. ie $s0, $s1
  • Processor can keep only a small amount of data in registers, but computer memory contains million of data elements
  • Hence complex data structures, such as arrays, are kept in memory
  • Arithmetic operations occur only on registers in MIPS instructions
  • Data transfer instructions are instructions that transfer data between memory and registers (traditionally called load)
  • To access a word in memory, the instruction must supply the memory address
  • Memory is a large, single-dimensional array with the address acting as the index to that array, starting at 0
  • The actual MIPS name for data transfer instruction is lw, standing for load word. ie lw  $t0, 8($s3)
  • The constant in a data transfer instruction is called the offset, and the register added to form the address is called the base register
  • Most architectures address individual bytes - address of sequential words differ by 4
  • Words must always start at addresses that are multiples of 4 in MIPS (alignment restriction)
  • The instruction complementary to load is traditionally called store (transfer data from a register to memory) 
  • The actual MIPS name is sw, standing for store word
  • The process of putting less commonly used variables into memory is called spilling registers

1 comment: