l11 hll to assembler
Download
Skip this Video
Download Presentation
L11-HLL to Assembler

Loading in 2 Seconds...

play fullscreen
1 / 20

L11-HLL to Assembler - PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on

ECE 2560. L11-HLL to Assembler. Department of Electrical and Computer Engineering The Ohio State University. HLL to Assembler. Pseudo HLL HLL structure Their flow chart HHL code Corresponding Assembler. What is Pseudo HLL.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' L11-HLL to Assembler' - kamella-varga


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
l11 hll to assembler

ECE 2560

L11-HLL to Assembler

Department of Electrical and

Computer Engineering

The Ohio State University

ECE 3561 - Lecture 1

hll to assembler
HLL to Assembler
  • Pseudo HLL
  • HLL structure
    • Their flow chart
    • HHL code
    • Corresponding Assembler

ECE 3561 - Lecture 1

what is pseudo hll
What is Pseudo HLL
  • Pseudo HLL is a way of expressing an algorithm or procedure for performing a task.
  • Very similar to modern High Level programming Languages
  • Best illustrated with an example

ECE 3561 - Lecture 1

pseudo hll example
Pseudo HLL example
  • Sum a list of 10 integers
    • 3 7 8 2 4 6 5 5 9 1
  • There are several methods
  • The algorithm here
    • Create sum and initialize to 0
    • Add first number
    • Repeat adding number until done with list

ECE 3561 - Lecture 1

pseudo hll
Pseudo HLL
  • Sequence of Actions
    • Do action A
    • Do action B
    • ….
    • Do action Q

ECE 3561 - Lecture 1

decisions
Decisions
  • Decision structures
  • IF condition THEN action if true
  • ELSE action if false
  • END IF;
  • Example:
    • Remove front bike wheel
    • TURN Bike over
    • IF wheel-has-quick-release-skewer
    • THEN flip level and remove wheel
    • ELSE use wrench to remove nuts from axle
    • remove wheel
    • END IF

ECE 3561 - Lecture 1

repeat structures
Repeat structures
  • Finite number of times – DO LOOP
  • Set up any values for loop
  • FOR counter = start TO end [STEP x] LOOP
  • actions of loop
  • END FOR;
  • Example:
    • Sum = 0;
    • FOR i = 1 to 10 LOOP
    • Sum = Sum + element(i);
    • END FOR;

ECE 3561 - Lecture 1

repeat structures1
Repeat structures
  • Indeterminate number of times – Repeat loop or decision loop – action inside the loop causes condition to occur that ends the loop.
  • 2 structures
    • One has code that executes at least once
    • One has code that may or may not execute at all

ECE 3561 - Lecture 1

while condition
While condition
  • While loop – may or may not execute code
    • WHILE condition LOOP
    • SEQUENCE_of_ACTIONS
    • END loop;
    • Example:
    • WHILE not EOF LOOP
    • Read line from file
    • Process line
    • END LOOP;

ECE 3561 - Lecture 1

repeat
Repeat
  • Repeat Until structure
    • REPEAT
    • Sequence_of_statements
    • UNITL condition;
  • Example - attempt to read will be done at least once
    • REPEAT
    • Read line from file
    • UNTIL EOF;

ECE 3561 - Lecture 1

now what is the assembler
Now what is the assembler?
  • For each of these Pseudo HLL structures what is the corresponding assembler.
  • Each will have assumption as to were data to be tested is.

ECE 3561 - Lecture 1

straight line code sequence
Straight line code - Sequence
  • Straight line Pseudo HLL – little modification is needed.
    • A = m*x + b in Pseudo HLL
    • Where are values – say in memory locations labeled by the same name
    • Code becomes
    • mov m,R8
    • push R8
    • push x
    • call smult
    • pop
    • pop R8
    • add b,R8
    • mov R8,A

ECE 3561 - Lecture 1

decision
Decision
  • Decision structure
  • IF condition THEN action if true
  • ELSE action if false
  • END IF;
  • Example:
    • IF (A<B) THEN temp=A; A=B; B=temp
    • END IF;

ECE 3561 - Lecture 1

assembler for example
Assembler for example
  • A and B are in memory
  • Will use a register for temp.
    • cmp A,B ;B-A is positive if A<B
    • jl noexch ;jump if B<A
    • mov A,R6
    • mov B,A
    • mov R6,A
    • noexch

ECE 3561 - Lecture 1

a more efficient coding
A more efficient coding
  • Could be made a little more efficient
    • Previous code also exchanges when A=B
    • cmp B,A ;A-B is negative if A<B
    • jgenoexch ;jump if B<=A
    • mov A,R6
    • mov B,A
    • mov R6,A
    • noexch

ECE 3561 - Lecture 1

when there is an else
When there is an else
  • Else is similar to the previous code
    • IF (A<B) THEN temp=A; A=B; B=temp;
    • ELSE A = 0;
    • END IF;
  • Much like previous
    • cmp B,A ;A-B is negative if A<B
    • jge else ;jump if B<=A
    • mov A,R6
    • mov B,A
    • mov R6,A
    • jmp after
    • else clr A
    • after

ECE 3561 - Lecture 1

repeat structures2
Repeat structures
  • Finite number of times – DO LOOP
  • Set up any values for loop
  • FOR counter = start TO end [STEP x] LOOP
  • actions of loop
  • END FOR;
  • Example:
    • Sum = 0;
    • FOR i = 1 to 10 LOOP
    • Sum = Sum + element(i);
    • END FOR;
  • How would this example be coded?

ECE 3561 - Lecture 1

coding for do loop
Coding for Do Loop
  • Where are control values?
    • i – the current index value – use R9
    • startval – the starting value for i – memory loc
    • endval – the ending value for i – memory
    • sum – in memory
    • element – label of list of values in memory
    • mov i,R9
    • tolcmp endval,R9 ;R9-endval
    • jgelpexit
    • mov R9,R8
    • dec R8
    • clrc
    • rolc R8
    • add #element,R8
    • add @R8,sum
    • inc R9
    • jmptol
    • lpexit

ECE 3561 - Lecture 1

the repeat and while loops
The repeat and while loops
  • The coding of the repeat and while loops is very similar.
    • Documents where variables are
    • Need loop control and testing of loop control
    • Which branch instruction to use takes some thought
    • Need to remember what the cmp instruction does!!

ECE 3561 - Lecture 1

summary assignment
Summary - Assignment
  • No new assignment.

ECE 3561 - Lecture 1

ad