0% found this document useful (0 votes)
6 views8 pages

lecture_slides_00_002-theme

The document outlines a class at the University of Washington focused on the hardware/software interface, discussing the evolution of programming languages from low-level machine code to high-level languages like C and Java. It emphasizes the importance of understanding this interface for effective programming and debugging. Key themes include the historical perspective of hardware and software development, the role of assemblers, and the abstraction levels in computing.

Uploaded by

yihuangece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

lecture_slides_00_002-theme

The document outlines a class at the University of Washington focused on the hardware/software interface, discussing the evolution of programming languages from low-level machine code to high-level languages like C and Java. It emphasizes the importance of understanding this interface for effective programming and debugging. Key themes include the historical perspective of hardware and software development, the role of assemblers, and the abstraction levels in computing.

Uploaded by

yihuangece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

University

 of  Washington  

What  is  this  class  about?  


¢ What  is  hardware?  so8ware?  
¢ What  is  a  hardware/so8ware  interface?  
¢ Why  do  we  need  to  understand  this  interface?  
University  of  Washington  

C/Java,  assembly,  and  machine  code  


if (x != 0) y = (y+z)/x;!

cmpl $0, -4(%ebp) 1000001101111100001001000001110000000000


je .L2 0111010000011000
movl -12(%ebp), %eax 10001011010001000010010000010100
movl -8(%ebp), %edx 10001011010001100010010100010100
leal (%edx, %eax), %eax 100011010000010000000010
movl %eax, %edx 1000100111000010
sarl $31, %edx 110000011111101000011111
idivl -4(%ebp) 11110111011111000010010000011100
movl %eax, -8(%ebp) 10001001010001000010010000011000
University  of  Washington  

C/Java,  assembly,  and  machine  code  


if (x != 0) y = (y+z)/x;!

  
cmpl $0, -4(%ebp) 1000001101111100001001000001110000000000
je .L2 0111010000011000
movl -12(%ebp), %eax 10001011010001000010010000010100
movl -8(%ebp), %edx # 10001011010001100010010100010100
leal (%edx, %eax), %eax 100011010000010000000010
movl %eax, %edx
# 1000100111000010
sarl
idivl
$31, %edx
-4(%ebp)
   110000011111101000011111
11110111011111000010010000011100
movl %eax, -8(%ebp) 10001001010001000010010000011000

l The  three  program  fragments  are  equivalent  


l You'd  would  rather  write  C!  –  a  more  human-­‐friendly  language  
l The  hardware  likes  bit  strings!  –  0  and  1  as  low  or  high  voltages  
l The  machine  instruc.ons  are  actually  much  shorter  than  the  number  of  
bits  we  would  need  to  represent  the  characters  in  the  assembly  language  
University  of  Washington  

HW/SW  Interface:  The  Historical  PerspecNve  


¢ Hardware  started  out  quite  primiNve  
§ Hardware  designs  were  expensive  ⇒  instruc.ons  had  to  be  very  simple  
–  e.g.,  a  single  instruc.on  for  adding  two  integers  
¢ So8ware  was  also  very  primiNve  
§ So?ware  primi.ves  reflected  the  hardware  preAy  closely  

Architecture Specification (Interface)

Hardware
University  of  Washington  

HW/SW  Interface:  Assemblers  


¢ Life  was  made  a  lot  beQer  by  assemblers  
§ 1  assembly  instruc.on  =  1  machine  instruc.on,  but...  
§ different  syntax:  assembly  instruc.ons  are  character  strings,  not  bit  
strings,  a  lot  easier  to  read/write  by  humans  
§ can  use  symbolic  names  
Assembler specification

User
program
in Assembler Hardware
asm
University  of  Washington  

HW/SW  Interface:  Higher-­‐Level  Languages  


¢ Higher  level  of  abstracNon:  
§ 1  line  of  a  high-­‐level  language  is  compiled  into  many  (some.mes  very  
many)  lines  of  assembly  language  

C language specification

User
program C Assembler Hardware
in C compiler
University  of  Washington  

HW/SW  Interface:  Code  /  Compile  /  Run  Times  

Code  Time   Compile  Time   Run  Time  

User
program C Assembler Hardware
in C compiler

.c file .exe file

Note: The compiler and assembler are just programs, developed using
this same process.
University  of  Washington  

The  Big  Theme  


¢ THE  HARDWARE/SOFTWARE  INTERFACE  
 
¢ How  does  the  hardware  (0s  and  1s,  processor  execuNng  
instrucNons)  relate  to  the  so8ware  (Java  programs)?  
¢ CompuNng  is  about  abstracNons  (but  we  can’t  forget  reality)  
¢ What  are  the  abstracNons  that  we  use?  
¢ What  do  YOU  need  to  know  about  them?  
§ When  do  they  break  down  and  you  have  to  peek  under  the  hood?  
§ What  bugs  can  they  cause  and  how  do  you  find  them?  
¢ Become  a  beQer  programmer  and  begin  to  understand  the  
important  concepts  that  have  evolved  in  building  ever  more  
complex  computer  systems  

You might also like