1 / 8

Erik Jonsson School of Engineering and Computer Science

Erik Jonsson School of Engineering and Computer Science. EE/CE 2310 – HON/002. Introduction to Digital Systems. http://www.utdallas.edu/~pervin. Tuesday: Finish Chapters P3 & P4. Thursday 2-09-12. FEARLESS Engineering. www.utdallas.edu/~pervin. Overview. (T5) Decoders & Multiplexers

ilar
Télécharger la présentation

Erik Jonsson School of Engineering and Computer Science

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Erik Jonsson School of Engineering and Computer Science EE/CE 2310 – HON/002 Introduction to Digital Systems http://www.utdallas.edu/~pervin Tuesday: Finish Chapters P3 &P4 Thursday 2-09-12 FEARLESS Engineering www.utdallas.edu/~pervin

  2. Overview (T5) Decoders & Multiplexers >>>>>Based on Dr. Dodge’s Notes!!<<<<< (P3) PCSPIM, QtSPIM, XSPIM, MIPSter (P4) Arrays and Pointers

  3. Decoders & Multiplexers – Dodge Lecture 6 http://www.utdallas.edu/~dodge/EE2310/lec6.pdf Go over this carefully!!

  4. Arrays and Pointers • array: .space 100 #100 bytes (25 words) in .data section int[] array; • For example, suppose we have the following code: • .data • array: .space 100 • .text • … # some code • la $t0,array • The SPIM assembler will give us a line of code such as • 0x3c081001 lui $8, 4097 [array] ; 7: la $t0,array • The “[array]” note is just to help the programmer and is not part of the code. The instruction itself (lui $8,4097) places 0x1001 = 4097DEC in the upper half (lui = Load Upper Immediate) of register 8 ($t0). The agreement is that our portion of the .data segment is to start at location 0x10010000 and that is what is put in $t0.

  5. Now suppose we started our .data segment differently: • .data • begin: .asciiz “Begin: ” # 8 characters (space + zero byte) • array: .space 100 • end: .asciiz “End” • .text • … # some code • la $t0,array • The assembler will give us two lines of code such as • 0x3c011001 lui $1, 4097 [array] ; 8: la $t0,array • 0x34280008 ori $8, $1, 8 [array] • Note: • 0x3c011001 lui $1, 4097 [end] ; 10: la $t1,end • 0x3429006c ori $9, $1, 108 [end]

  6. .word directive • .data • begin: .asciiz “Begin:” #NOTE: no space • worda: .word 0xffffffff • array: .space 100 • wordb: .word 0xeeeeeeee • end: .asciiz “End” • .text • … # some code • la $t0,array • Now we get • [0x10010000] 0x69676542 0x00003a6e 0xffffffff 0x00000000 • [0x10010010]...[0x1001006c] 0x00000000 • [0x1001006c] 0x00000000 • [0x10010070] 0xeeeeeeee 0x00646e45 0x00000000 0x00000000 • [0x10010080]...[0x10040000] 0x00000000

  7. For loop • for( i == 0 ; i < 25 ; i++) {array[i] = i;} • The assembler code for this statement could be: • # assume: $t0 contains the address of the 100 bytes • # (maybe after an la $t0,array instruction) • # assume: $t1 contains the integer 25 • # (the number of words desired) • # assume: $s0 contains the counter i; first initialize it to zero • li $s0,0 # or move $s0,$0 or some other initialization • loop: beq $s0,$t1,done # when i == 25 we are finished, branch • sw $s0,0($t0) # array[i] = i; • add $t0,$t0,4 # each integer is 4 bytes long • add $s0,$s0,1 # increment the count by 1 • j loop # go back and do the loop test again • done: # ready for the next instruction; however, • # $t0 no longer contains the address of the 100 bytes = 25 words!

  8. Tuesday (P4) Arrays and Pointers We’re slowly coming up on the first exam! Look at the assignments on the web page. If you think you have little to do, you’re wrong!

More Related