3. Computer Design Motaz K. Saad, Dept. of CS Programmer’s View Logic Designer’s View Instruction Set Design Machine Organization Machine Language Machine Implementations Computer Interface Hardware Components Compiler/System View Logic Designer’s View
4. Computer Architecture Design I/O system Instr. Set Proc. Compiler Operating System Application Digital Design Instruction Set Architecture Datapath & Control Software Hardware Circuit Design Motaz K. Saad, Dept. of CS
5.
6. Below Your Program High-level language program in C void swap(int v[ ], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } Motaz K. Saad, Dept. of CS swap: muli $2, $5, 4 add $2, $4, $2 lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) jr $31 Compiler Assembly language Program (for MIPS) 00000000101000010000000000011000 00000000100011100001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000 Assembler Binary machine language program (for MIPS)
7.
8.
9. Trying it out on different architectures! #include <stdio.h> void swap ( int v [ ], int k ); void print_vector ( int v [ ]); int main( int argc , char * argv [ ]) { int v []={1,3,5,7,9,-1}; print_vector(v); swap(v,2); print_vector(v); } void swap ( int v [], int k ) { int temp ; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } void print_vector ( int v []) { int i ; for (i=0 ; v[i]>0 ; i++) printf(" %d ",v[i]); printf(" "); } Motaz K. Saad, Dept. of CS
18. Anatomy of an Object File Motaz K. Saad, Dept. of CS Size and position of other pieces. Machine Code Binary Data Representation. References that must change if the program is moved in memory. Associate addresses with external label. Unresolved references. Compilation information to allow mapping of addresses to source code.