1 HW #6 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. You can use any instruction used in the.

Slides:



Advertisements
Similar presentations
Lecture 5: MIPS Instruction Set
Advertisements

Central Processing Unit
MIPS assembly. Review  Lat lecture, we learnt  addi,  and, andi, or, ori, xor, xori, nor,  beq, j, bne  An array is stored sequentially in the memory.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /15/2013 Lecture 11: MIPS-Conditional Instructions Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
R1R1 R1R1 R2R2 R2R2 PC MDR MAR Y Y Z Z IR Control/Decode Unite Constant 4 1 Dr. Esam Al_Qaralleh.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Translating high level language into machine code
Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009
COMPUTER INSTRUCTIONS
Computer System Architecture ESGD2204
Chapter No 5 Basic Computer Organization And Design.
1 Basic Computer Organization & Design Computer Organization Computer Architectures Lab BASIC COMPUTER ORGANIZATION AND DESIGN Instruction Codes Computer.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Bus Architecture Memory unit AR PC DR E ALU AC INPR 16-bit Bus IR TR
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Lecture 15 Today’s lecture MARIE programming Assembler
Exam2 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
11/02/2009CA&O Lecture 03 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Chapter # 6 PROGRAMING THE BASIC COMPUTER.
1 Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can be specified with register transfer statements.
Lec 5 Basic Computer Organization
M. Mateen Yaqoob The University of Lahore Spring 2014
Lecture Set 4 Programming the 8051.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
1 Basic Computer Organization & Design Computer Organization Prof. H. Yoon BASIC COMPUTER ORGANIZATION AND DESIGN Instruction Codes Computer Registers.
Instruction.
Ch5. 기본 컴퓨터의 구조와 설계.
8085 processor.
COMPUTER ORGANIZATION LECTURE 3: ISA YASSER MOHAMMAD.
Processor Organization
1 Verilog HW #8 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. Store the sum in the address 99.
Program to multiply 2 numbers 500-Input x 291-Store acc. as x 500-Input y 292-Store acc. as y 193-Load y in to acc. (0 on 1 st parse) 391-Add x to acc.
Basic Computer Organization - Part 2 Designing your first computer
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Little Man Computer Task 1 Last lesson you were asked to write a program to multiply two numbers together. The next slide has a working program to do this.
1 BASIC COMPUTER ORGANIZATION AND DESIGN Instruction Codes Computer Registers Computer Instructions Timing and Control Instruction Cycle Memory Reference.
Instruction Memory value Description ADD1xx Add the value stored at memory address xx to the value in the accumulator register SUB2xx Subtract the value.
Vector Operations and Indexing Competency: C5 Lecture no. 20.
PROGRAMMING THE BASIC COMPUTER
PROGRAMMING THE BASIC COMPUTER
Symbol Hex Code Description I=0 I=1
PROGRAMMING THE BASIC COMPUTER
Computer Architecture & Operations I
Basic Pipeline Datapath
ADVANCED PROCESSOR ARCHITECTURE
Computer Organization and Design
BASIC COMPUTER ORGANIZATION AND DESIGN
Overview Instruction Codes Computer Registers Computer Instructions
INDEX UNIT-III PPT SLIDES
Computer Science 210 Computer Organization
BASIC COMPUTER ORGANIZATION AND DESIGN
BASIC COMPUTER ORGANIZATION AND DESIGN
Computer Science 210 Computer Organization
By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU
Assembler CASE Tool.
PROGRAMMING THE BASIC COMPUTER
Design of the Control Unit for One-cycle Instruction Execution
Instruction and Control II
Sequencing, Selection, and Loops in Machine Language
By: A. H. Abdul Hafez Computer Architecture and Organization: L06: Stored program and Instruction code.
Computer Architecture and Organization: L07: Control Sequence
PROGRAMMING THE BASIC COMPUTER
MARIE: An Introduction to a Simple Computer
EECE.3170 Microprocessor Systems Design I
Lecture 11 Z80 Instruction Hong DGU.
CS-401 Computer Architecture and Assembly Language Programming
EECE.3170 Microprocessor Systems Design I
PROF. JOHN ABRAHAM UTRGV
Presentation transcript:

1 HW #6 Write an assembly program to calculate the sum of the ten scores stored in memory as shown on the right. You can use any instruction used in the lecture slides but try to minimize your instruction set. If you need to, you can make your own instruction such as LDC. LDC // Load constant number to AC ex) LDC 9 // AC <= 9

function call vs. goto main ( ) { for (i=0; i < 10; i++) add (&sum, score ); printf (“%d”, sum); } add (&sum, score ) { sum = sum + score[i]; } 2 main ( ) { i = 0; loop : sum = sum + score[i]; i = i + 1; if (i != 10) goto loop; printf (“%d”, sum); }

add 110 // AC <= AC + mem[110] add [110] // AC <= AC + mem[mem[110]] isz 100 // mem[100]= mem[100]+1 // if mem[100] == 0, skip next instruction, AND 0xxx 8xxxAND memory word to AC ADD 1xxx 9xxxAdd memory word to AC BUN 4xxx CxxxBranch unconditionally BSA 5xxx DxxxBranch and save return address ISZ 6xxx ExxxIncrement and skip if zero SymbolI = 0I = 1Description isz T4 ~ T6 : D 6 T 4 : DR <- M[AR] D 6 T 5 : DR <- DR +1 D 6 T 6 : M[AR] <- DR, if (DR = 0) then PC <- PC +1, SC <- 0