CS 2150 Roadmap

Data Representation

Program Representation

 
 
string
 
 
 
int x[3]
 
 
 
char x
 
 
 
0x9cd0f0ad
 
 
 
01101011
vertical red double arrow  
Objects
 
Arrays
 
Primitive types
 
Addresses
 
bits
           
 
Java code
 
 
C++ code
 
 
C code
 
 
x86 code
 
 
IBCM
 
 
hexadecimal
vertical green double arrow  
High-level language
 
Low-level language
 
Assembly language
 
Machine code

Memory Hierarchy, part 1

memory hierarchy
  • CPU registers
    • 1 access per CPU cycle
    • 3*109 accesses per sec
    • 1 Kb total storage
  • Cache
    • SDRAM: 10 ns
    • 108 accesses per sec
    • Multiple levels possible
    • Higher levels are bigger and slower
    • 1 Mb total storage

Memory Hierarchy, part 2

memory hierarchy
  • Main memory
    • DRAM: 60 ns
    • 2*107 accesses per sec
    • Limited by bus speeds
    • 1 Gb total storage
  • Disk
    • HDD speeds: 5 ms
    • 200 accesses per sec
    • 1 Tb total storage

IBCM Machine: Memory

  • 4096 16-bit words
    • Word
      • "chunk size" or addressable unit
    • All initialized to zero initially
      • Unlike C/C++
ibcm memory diagram

IBCM instruction format

 15 14 13 12 11  10 ... 0
 0 0 0 0  
 
(unused)   halt
 0 0 0 1 I/O
op
(unused)   I/O
 0 0 1 0  shift
op
(unused)  count shifts
 opcode   address  
 
 others

IBCM "other" instructions

OpNameHLL meaningDescription
3loada := mem[addr]load accumulator from memory
4storemem[addr] := astore accumulator into memory
5adda := a + mem[addr]add memory to accumulator
6suba := a - mem[addr]subtract memory from accumulator
7anda := a ∧ mem[addr]logical 'and' memory into accumulator
8ora := a ∨ mem[addr]logical 'or' memory into accumulator
9xora := a ⊕ mem[addr]logical 'xor' memory into accumulator
Anota := ~alogical complement of accumulator
Bnop/* */do nothing (no operation)
Cjmpgoto addrjump to 'addr'
Djmpeif a == 0 goto addrjump to 'addr' if accumulator == zero
Ejmplif a < 0 goto addrjump to 'addr' if accum. is < zero
Fbrla := PC+1; goto addrjump (branch) to 'addr'; set accum. to
PC+1 (next inst) and jump

IBCM Machine

AddressContentsCommand
0000000halt
001000fhalt
0020005halt
0033001load mem[1]
0045002add mem[2]
0050000halt
 
PC 
 
IR
 
Accum

Sample Program

AddressContentsCommand
0003000load mem[0]
0015000add mem[0]
0026001sub mem[1]
0038003or mem[3]
004a000not
0054000store mem[0]
006f000brl mem[0]
 
 
PC 
 
IR
 
Accum

How Would You Code This?

if (B == 0)
    S1;
else
    S2;

How Would You Code This?

while(B >= 5)
    S;

What's missing from IBCM?

  • Integer multiply and divide
  • Floating point support
  • A bigger address space
  • More than 1 user register
  • What else?