Session 4: Atomic Language. Take Turing Machine Look back to 1 st session’s work on hardware, RISC and CISC register- based machines. Also look forward.

Slides:



Advertisements
Similar presentations
Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program.
Advertisements

A simple register allocation optimization scheme.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
CSC 221 Computer Organization and Assembly Language Lecture 21: Conditional and Block Structures: Assembly Programs.
Assembly Language for x86 Processors 6th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy this slide.
COMP 2003: Assembly Language and Digital Logic
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
Pipeline Enhancements for the Y86 Architecture
CS2422 Assembly Language & System Programming October 3, 2006.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
1 Lecture 5: Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Accessing parameters from the stack and calling functions.
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
Microprocessor Systems Design I
Practical Session 8 Computer Architecture and Assembly Language.
Assembly Language Lecture 0: Introduction. Outline What is Assembly Language? Why learn Assembly Language? Grade Text Book.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2:
Recitation 2: Assembly & gdb Andrew Faulring Section A 16 September 2002.
Sahar Mosleh California State University San MarcosPage 1 Applications of Shift and Rotate Instructions.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
Algorithms, Algorithmic Thinking and Structured Code.
Linked Lists in MIPS Let’s see how singly linked lists are implemented in MIPS on MP2, we have a special type of doubly linked list Each node consists.
CSC 221 Computer Organization and Assembly Language
Code Generation Gülfem Savrun Yeniçeri CS 142 (b) 02/26/2013.
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Dr. José M. Reyes Álamo 1.  Review: ◦ of Comparisons ◦ of Set on Condition  Statement Labels  Unconditional Jumps  Conditional Jumps.
Module 3 Instruction Set Architecture (ISA): ISA Level Elements of Instructions Instructions Types Number of Addresses Registers Types of Operands.
Machine-Level Programming 3 Control Flow Topics Control Flow Switch Statements Jump Tables.
1 ICS 51 Introductory Computer Organization Fall 2009.
X86 Architecture.
Assembly Language Friday, Week 5 Monday, Week 6. Assembly Language  Set of mnemonic names for the instructions in a particular computer's machine language.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Chapter 5 Branching and Looping.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures.
Machine-Level Programming 2 Control Flow Topics Condition Codes Setting Testing Control Flow If-then-else Varieties of Loops Switch Statements.
Recitation 3: Procedures and the Stack
Machine-Level Programming 2 Control Flow
Unit 1 Instruction set M.Brindha AP/EIE
Computer Architecture CST 250
Assembly language.
Assembly Lab 3.
Data Transfers, Addressing, and Arithmetic
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Anton Burtsev February, 2017
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
Microprocessor Systems Design I
Microprocessor and Assembly Language
Assembly IA-32.
Computer Architecture adapted by Jason Fritts then by David Ferry
asum.ys A Y86 Programming Example
Y86 Processor State Program Registers
BIC 10503: COMPUTER ARCHITECTURE
Data-Related Operators and Directives
Machine-Level Programming 2 Control Flow
Fundamentals of Computer Organisation & Architecture
MIPS Procedure Calls CSE 378 – Section 3.
Information Security - 2
Practical Session 4.
Machine-Level Programming 2 Control Flow
The Von Neumann Architecture Odds and Ends
Computer Architecture CST 250
CSC 497/583 Advanced Topics in Computer Security
ICS51 Introductory Computer Organization
MUL operation.
Computer Architecture and Assembly Language
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Presentation transcript:

Session 4: Atomic Language. Take Turing Machine Look back to 1 st session’s work on hardware, RISC and CISC register- based machines. Also look forward to next week’s work on Software, computer programming languages.

S1 ? ? S2 S1 S2 Sn

S1 ? ?

ax eax rax

q s mn (s,m,n,q)(s*,m*,n*,q*)

q s mn (s,m,n,q)(s’,m’,n’,q’)

s mn (s,m,n) = (,, )

s* m*n* (s*,m*,n*) = (,, )

s mn (s,m,n) = (,, )

s* m*n* (s*,m*,n*) = (,, )

mov reg,0 Put 0 into register “reg” inc reg Add 1 to the contents of register “reg” decjmpreg reg,lab If register “reg” is zero, jump to the label “lab” else subtract 1 from “reg” and do the next instruction jmp lab Jump straight to the label “lab” hlt Halt

inc reg Add 1 to the contents of register “reg” decjmpreg reg,lab If register “reg” is zero, jump to the label “lab” else subtract 1 from “reg” and do the next instruction

assume ecx is zero inc ecx assume ecx is zero L1:… … decjmpreg ecx,L1

mov ecx,3 mov eax,0 mov ebx,0 L3:decjmpreg ecx,L4 inc ebx jmp L3 L4:nop eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov eax,0 inc eax hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov ecx,3 decjmpreg ecx,L1 L1: hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov ecx,3 L2: decjmpreg ecx,L1 jmp L2 L1: hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

is S = q? read line inc line pointer end of Table? end (error) is “read” = s? inc line pointer move left/right write in cell Current state readwritemove L / R New state write in cell end of Table? end (error)

main PROC mov ecx,N mov eax,0 l1:mov ebx,0 decjmpz l2 inc ebx decjmpz l2 inc eax jmp l1 l2:hlt main ENDP ecxebxeax

m s n z ALU smn

m s n z z = 2m z = z + s m* = z s* = rem(n/2) n = z z = n/2

mov ecx,5 mov eax,0 L3:mov ebx,0 decjmpreg ecx,L4 inc ebx decjmpreg ecx,L4 inc eax jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov ecx,5 mov eax,0 L3:mov ebx,0 decjmpreg ecx,L4 inc ebx decjmpreg ecx,L4 inc eax jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx 0 0 1

mov ecx,3 mov eax,0 L3:decjmpreg ecx,L4 inc eax jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov eax,3 mov edx,0 L3:decjmpreg eax,L4 inc edx jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov ecx,3 L3:mov eax,0 decjmpreg ecx,L4 inc eax jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov reg,0 inc reg decjmpz L jmp L

mov ecx,3 mov ebx,0 L3:decjmpreg ecx,L4 inc ebx jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov ecx,3 mov ebx,0 L3:decjmpreg ecx,L4 inc ebx jmp L3 L4:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx 0 5 6

… L1:decjmpreg ecx,L2 jmp L1 L2… eaxeax ebxebx ecxecx edxedx 3 2 eaxeax ebxebx ecxecx edxedx 1 eaxeax ebxebx ecxecx edxedx 0

L2:decjmpreg eax,L1 inc edx jmp L2 L1:decjmpreg ebx,L3 inc edx L3:decjmpreg edx,L4 inc eax jmp L3 L4:mov ebx,0 decjmpreg ecx,L6 inc ebx decjmpreg ecx,L6 inc edx jmp L4 L6:decjmpreg edx,L7 inc ecx jmp L6 L7:hlt eax holds m ebx holds s ecx holds n edx holds z If s is 1 z = z + 1 z = 2m m* = z s* = rem(n/2) z = n/2 whole n* = z

remwhole

decjmpreg ebx,L3 inc edx L3:

eax holds m ebx holds s ecx holds n edx holds z

s mn

s mn

s mn

; get current state ; read current symbol s. (Read ebx) ; get new state using value of s (in ebx) ; write new symbol.(Write to ebx) ; get the movement direction ; execute the movement code (left or right)

; assume we start in state 0 ; write the starting symbol into ebx ; write the code for move right or move left ; write the new symbol into ebx ; jump to the new state code ; repeat lines 2 to 4

The movement code (left or right) depending on the state

1 2 x y

Head move right code Head move left code

read the symbol s store s if(s == 0), set s = 0 and jmp to move-right code if(s == 1), set s = 0 and jmp to move-right code use the stored s if(s == 0), jump to the even state code if(s == 1), jump to the odd state code

mov eax,3 inc eax inc ebx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov ecx,2 L1:decjmpreg ecx,L2 jmp L1 L2:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

mov eax,0 mov ecx,2 L1:decjmpreg ecx,L2 inc eax jmp L1 L2:hlt eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

read the symbol s store s if(s == 0), set s = 0 and jmp to move-right code if(s == 1), set s = 0 and jmp to move-right code use the stored s if(s == 0), jump to the even state code if(s == 1), jump to the odd state code Code for read-write head move left Code for read-write head move right Current State S Symbol read s Symbol to write s* Directio n to move d New state S* Even00R 10ROdd State Even

eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx eaxeax ebxebx ecxecx edxedx

Turing Machine Table Tape t R/W Head