1 A Simple but Realistic Assembly Language for a Course in Computer Organization Eric Larson Moon Ok Kim Seattle University October 25, 2008.

Slides:



Advertisements
Similar presentations
Assembly Language.
Advertisements

Henk Corporaal TUEindhoven 2011
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Lecture 5: MIPS Instruction Set
CS/COE0447 Computer Organization & Assembly Language
Syllabus Instructor: Dr. Wesam Ashour
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /15/2013 Lecture 11: MIPS-Conditional Instructions Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
Chapter 2.
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
Chapter 2 Machine Language. Machine language The only language a computer can understand directly. Each type of computer has its own unique machine language.
Term Project Overview Yong Wang. Introduction Goal –familiarize with the design and implementation of a simple pipelined RISC processor What to do –Build.
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Topic 1: Introduction to Computers and Programming
Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 1 Introduction.
MIPS Instruction Set Advantages
Winter 2015 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University Introduction and Overview.
CDA 3101 Fall 2012 Introduction to Computer Organization Instruction Set Architecture MIPS Instruction Format 04 Sept 2013.
CS-2710 Computer Organization Dr. Mark L. Hornick web: faculty-web.msoe.edu/hornick – CS-2710 info syllabus, homework, labs… –
Machine Instruction Characteristics
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Cosc 2150: Computer Organization
Computer Systems Organization CS 1428 Foundations of Computer Science.
Introduction and Overview Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 12 Overview and Concluding Remarks.
Lecture 4: MIPS Instruction Set Reminders: –Homework #1 posted: due next Wed. –Midterm #1 scheduled Friday September 26 th, 2014 Location: TODD 430 –Midterm.
6.S078 - Computer Architecture: A Constructive Approach Introduction to SMIPS Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts.
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
Computer Architecture Souad MEDDEB
Small constants are used quite frequently (50% of operands) e.g., A = A + 5; B = B + 1; C = C - 18; Solutions? Why not? put 'typical constants' in memory.
CHAPTER 6 Instruction Set Architecture 12/7/
 1998 Morgan Kaufmann Publishers MIPS arithmetic All instructions have 3 operands Operand order is fixed (destination first) Example: C code: A = B +
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
CS2100 Computer Organisation MIPS Part I: Introduction (AY2015/6) Semester 1.
Building Your Own Machine The Universal Machine (UM) Introduction Noah Mendelsohn Tufts University Web:
ECE 15B Computer Organization Spring 2011 Dmitri Strukov Partially adapted from Computer Organization and Design, 4 th edition, Patterson and Hennessy,
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
The Universal Machine (UM) Implementing the UM Noah Mendelsohn Tufts University Web:
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
CHAPTER 2 Instruction Set Architecture 3/21/
CS2100 Computer Organisation
MIPS Instruction Set Advantages
Instruction Set Architecture
Assembly Language Programming
COMP541 Datapaths I Montek Singh Mar 28, 2012.
Introduction CPU performance factors
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Assembly Programming using MIPS R3000 CPU
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
Topic 5: Processor Architecture Implementation Methodology
Topic 5: Processor Architecture
MARIE: An Introduction to a Simple Computer
COMS 361 Computer Organization
COMP541 Datapaths I Montek Singh Mar 18, 2010.
COMS 361 Computer Organization
Course Outline for Computer Architecture
Instruction Set Architecture
Presentation transcript:

1 A Simple but Realistic Assembly Language for a Course in Computer Organization Eric Larson Moon Ok Kim Seattle University October 25, 2008

Problem A few years ago we had two computer hardware courses:  Assembly Language Programming  Computer Organization Now we only have one course that combines the two courses. Result: Too much material to cover in one course. 2

Solution Use a simple, yet realistic, assembly language (ANNA) throughout the course. Focus on key concepts of assembly language programming. Does not burden students with the complexities of large instruction sets. ANNA can be used in illustrating the datapath and pipelining units. 3

Outline Background about the course ANNA assembly language and tools How ANNA was used in the course Feedback and Observations 4

Computer Organization Course 5 credit (quarter) sophomore level class  requirement for CS majors Main topics:  Data representation  Digital logic  Assembly language programming  Datapath and control  Memory hierarchy Material from other classes:  OS: virtual memory, some I/O  Discrete math: Boolean algebra Taught using ANNA three times 5

Assembly Language Concepts Key concepts in assembly language in our course: Registers and memory Conditional branches and jumps Translating high-level languages constructs into assembly:  if-else statements  loops  procedure calls  arrays and pointers Most importantly – experience actually writing assembly programs 6

ANNA Assembly Language v1 Memory is word addressable, words are 16 bits. Memory is shared by instructions or data. Data in memory / registers is either an integer or an address.  Can actually store anything – no instruction support for other data types. Load / store architecture 16 general purpose registers, register r0 is 0.  Wise to introduce a calling convention that reserves a register for the stack pointer. 16 instructions (next slide). 7

ANNA Instruction Set v1 8 OpcodeOperandsDescription add Rd Rs 1 Rs 2 Addition sub Rd Rs 1 Rs 2 Subtraction lli Rd Imm8Set lower bits using immediate lui Rd Imm8Set upper bits using immediate and Rd Rs 1 Rs 2 Bitwise and or Rd Rs 1 Rs 2 Bitwise or not Rd Rs 1 Bitwise not shf Rd Rs 1 Rs 2 Bit shift lw Rd Rs 1 Imm4Load word from memory sw Rd Rs 1 Imm4Store word from memory in RdGet a word from user input out RdSend a word to output bez Rd Imm8Branch if equal to zero bgz Rd Imm8Branch if greater than zero jalr Rd Rs 1 Jump and link register halt Halt the program

ANNA Instruction Set v2 Added a new add immediate “ addi ” instruction.  Stack pointer updates  Loop control variables Removed halt : made it a special case of the output instruction ( out r0 ).  Input / output / halt already greatly simplified Reduced the number of registers from 16 to 8.  Restricts register usage (function calls in particular).  Increases immediate sizes in the machine code format. 9

Tools Assembler: translates assembly language files (.ac) into machine language files (.mc). Simulator: loads and runs machine language files.  Debugging support: breakpoints, stepping, etc. First two quarters: used command-line tools on Linux.  Worked fine – students already know Linux and familiar with command line tools. Last quarter: students could use Windows GUI- based tools or the Linux command line tools.  Most, but not all, chose to use the Windows tools. 10

Assembler 11

Simulator 12

Computer Organization: Outline Topic Lecture Hours Data representation4 Digital design10 CPU components3 Assembly programming15 Datapath and pipelining8 Memory and caching5 Input / output2 Review / exams3 13 I did not require the students to purchase a textbook.

Computer Organization: Outline Topic Lecture Hours Data representation4 Digital design10 CPU components3 Assembly programming15 Datapath and pipelining8 Memory and caching5 Input / output2 Review / exams3 14 I did not require the students to purchase a textbook.

Course Information: Lectures Assembly Language  Introduction to assembly  Converting C/C++ into assembly  Comparing ANNA to IA-32 instruction set  Overview of the compilation / linking process Datapath / control  Single cycle datapath (omits I/O instructions)  Control ROM implementation  Pipelining  We no longer cover multiple cycle datapath 15

Course Information: Assignments Assembly Language Programming  Find the highest number entered by a user.  Compute the log 2 of a number.  Find the mode of a set of numbers entered by the user.  Implement linked list functions. Control & Datapath  Add instruction X to the datapath and control ROM.  Create a control ROM for a different datapath / instruction set.  Trace the execution of a program in a pipelined implementation. 16

Students Feedback Most students felt…  they learned a lot when completing the ANNA programming assignments.  the ANNA tools were easy to use.  there was adequate documentation. There were several suggestions for improving the Windows tools:  line numbers in the assembler  knowing what addresses labels map to in the simulator 17

Course Outcomes Students were asked to judge how well a particular topic was covered. Scale: 1(not covered) to 5 (very well covered) Most topics received a 4. No topic received a 2 or lower. 18

My Observations Using the ANNA assembly language helped students learn the important concepts. No differences between the classes that use the Windows tools and Linux tools except for implementing function calls.  Could be due to improvements in lecture ANNA, a simple toy assembly language, did not dampen student motivation. The datapath and design went fairly well.  Some “hand-waving” at times (pun intended) Some students would benefit from having a textbook.  Most textbooks are tied to particular language. 19

Questions? More info? Contact me: Eric Larson 20