Memory technologies Access time Technologi Cost $/GB SRAM 1 ns - - PowerPoint PPT Presentation

memory technologies
SMART_READER_LITE
LIVE PREVIEW

Memory technologies Access time Technologi Cost $/GB SRAM 1 ns - - PowerPoint PPT Presentation

Memory technologies Access time Technologi Cost $/GB SRAM 1 ns 1000 DRAM 50 ns 100 HDD 10 ms 1 Fast memory is expensive and inexpensive memories are slow! Principal figures. William Sandqvist william@kth.se Memory Hierarchy


slide-1
SLIDE 1

William Sandqvist william@kth.se

Memory technologies

Technologi

Access time

Cost $/GB SRAM 1 ns 1000 DRAM 50 ns 100 HDD 10 ms 1

Fast memory is expensive and inexpensive memories are slow!

Principal figures.

slide-2
SLIDE 2

William Sandqvist william@kth.se

Memory Hierarchy

A three-level memory hierarchy. The faster memory types are used as "buffers" against the slower.

Principle

Primary memory Secondary memory

slide-3
SLIDE 3

Memory and memory chips

William Sandqvist william@kth.se

Memory: N words, widh M bits Memorychip: p words, widh q bits

  • Number of rows r ≤ N/p
  • Number of columns k ≥ M/q
  • Number of chips K = r × k

p, q N, M

k r K × =

Words Widh Number of chips

slide-4
SLIDE 4

William Sandqvist william@kth.se

SRAM

Each bit in a CMOS SRAM consists of a latch circuit made ​up

  • f six MOS transistors.

The memory cell is basically a SR-latch.

slide-5
SLIDE 5

William Sandqvist william@kth.se

DRAM

Each bit in a DRAM consists of a transistor and a capacitor. A charged capacitor leaks charge after a while. Periodically, all the capacitors must be searched and those who have charge left must then be reloaded. This is called

  • Refresh. It is managed by circuitry

within the memory.

slide-6
SLIDE 6

William Sandqvist william@kth.se

The capacitor is built on the depth

One bit in a DRAM takes the same place as two MOS transistors. One bit in the SRAM as six MOS transistors!

Trench Capacitor

slide-7
SLIDE 7

Infineon HYB25D25640 256 Mbit SDRAM

William Sandqvist william@kth.se

32M 25×220 = 225, 25 address bits

  • used. Time-multiplexed

addressing, 13-bit RAS (row), 10 bit CAS (columns), two bank bits BA0 and BA1. Burst can be 2, 4, 8 Bytes. Chip 256Mbit (32M×8) Synchronously, using the bus clock. Double-edge triggered for double data rate ck + ck (even lower power).

slide-8
SLIDE 8

William Sandqvist william@kth.se

Burst …

slide-9
SLIDE 9

William Sandqvist william@kth.se

Column address counter can quickly address

  • f the "neighboring memory cells" - the

memory can moore quickly deliver a burst with several bytes in sequence, than an totaly random acess.

Burst …

slide-10
SLIDE 10

William Sandqvist william@kth.se

Burst provides faster average access

  • To access 1 ”random” word in the memory takes three busscykles 3TBus/word

(2 TBUS are Waitstates)

  • To access a ”Burst” of 2 words takes 3+1 busscykles, 4/2 = 2TBus/word
  • To access a ”Burst” of 4 words takes 3+1+1+1 busscykles, 6/4 = 1,5TBus/word
  • To acess a ”Burst” of 8 words takes 3+1+1+1+1+1+1+1 cykles, 10/8 = 1,25TBus/word

It's important to have proper use of all fetched words - otherwise you are wasting bus clock cycles with the Burst method!

More about this in the Computer Organization course, when reading about caches.

slide-11
SLIDE 11

Ex 12.1 Dynamic Memory

William Sandqvist william@kth.se

a) How many chips are needed for 256M×64? Chip 256Mbit (32M×8)

slide-12
SLIDE 12

William Sandqvist william@kth.se

Memory N = 256M M = 64 bits. Chip p = 32M q = 8 bits. Number of columns k = M/q = 64/8 = 8. Number of rows r = N/p = 256M/32M = 8. Number of chips K = r × k = 8×8 = 64. a) How many chips are needed for 256M×64? Chip 256Mbit (32M×8)

Ex 12.1 Dynamic Memory

slide-13
SLIDE 13

512M×72 ?

b) How many chips are needed for 512M×72?

William Sandqvist william@kth.se

Chip 256Mbit (32M×8)

slide-14
SLIDE 14

512M×72 ?

Memory N = 512M M = 72 bits. Chip p = 32M q = 8 bits. Number of columns k = M/q = 72/8 = 9. Number of rows r = N/p = 512M/32M = 16. Number of chips K = r × k = 9 ×1 6 = 144.

William Sandqvist william@kth.se

Chip 256Mbit (32M×8) b) How many chips are needed for 512M×72?

slide-15
SLIDE 15

512M×72 ?

Memory N = 512M M = 72 bits. Chip p = 32M q = 8 bits. Number of columns k = M/q = 72/8 = 9. Number of rows r = N/p = 512M/32M = 16. Number of chips K = r × k = 9 ×1 6 = 144.

William Sandqvist william@kth.se

Chip 256Mbit (32M×8) b) How many chips are needed for 512M×72? The "unusual" bit width 72 (= 64 + 8). The 8 extra bits are used for correcting single faults, and to detect double faults. (In this way, even capsules small errors could be used as the error can be corrected. They would otherwise have to be discarded).

slide-16
SLIDE 16

512M×72 ?

Memory N = 512M M = 72 bits. Chip p = 32M q = 8 bits. Number of columns k = M/q = 72/8 = 9. Number of rows r = N/p = 512M/32M = 16. Number of chips K = r × k = 9 ×1 6 = 144.

William Sandqvist william@kth.se

Chip 256Mbit (32M×8) b) How many chips are needed for 512M×72? The "unusual" bit width 72 (= 64 + 8). The 8 extra bits are used for correcting single faults, and to detect double faults. (In this way, even capsules small errors could be used as the error can be corrected. They would otherwise have to be discarded). Or will a expensive memory be good even if some of the memory cells "wear out" over time.

slide-17
SLIDE 17

Ex 12.2 ROM and SRAM

William Sandqvist william@kth.se

Decoder 3-to-8 ROM 4M 512k × 8 bit ROM: RAM: SRAM 4M 512k × 8 bit Suppose that the ROM and the SRAM is to be connected to a 16-bit microprocessor having 24 bit addressing.

Micro- processor

slide-18
SLIDE 18

SRAM size?

William Sandqvist william@kth.se

How big is the figure SRAM, and which is the address area expressed in hexadecimal numbers

Micro- processor

slide-19
SLIDE 19

SRAM size?

William Sandqvist william@kth.se

How big is the figure SRAM, and which is the address area expressed in hexadecimal numbers

Micro- processor

  • Chip:

p = 512k q = 8 bits

  • Memory:

r = 3 k = 2 K = 2 × 3 = 6 M = k × q = 2 × 8 = 16 bits N = p × r = 512k × 3 = 1,5M

slide-20
SLIDE 20

SRAM size?

William Sandqvist william@kth.se

How big is the figure SRAM, and which is the address area expressed in hexadecimal numbers

Micro- processor

  • Chip:

p = 512k q = 8 bits

  • Memory:

r = 3 k = 2 K = 2 × 3 = 6 M = k × q = 2 × 8 = 16 bits N = p × r = 512k × 3 = 1,5M

WR WR RD RD = =

slide-21
SLIDE 21

SRAM address range?

William Sandqvist william@kth.se

Micro- processor

slide-22
SLIDE 22

SRAM address range?

William Sandqvist william@kth.se

Micro- processor

slide-23
SLIDE 23

SRAM address range?

William Sandqvist william@kth.se

Micro- processor

SRAM adress range: A80000 - BFFFFF

slide-24
SLIDE 24

Change the address range! ?

Change the address range to 980000 – AFFFFF ? 980000 1001|1000|0000|0000|0000|0000| AFFFFF 1010|1111|1111|1111|1111|1111|

William Sandqvist william@kth.se

slide-25
SLIDE 25

Change the address range! ?

Change the address range to 980000 – AFFFFF ? 980000 1001|1000|0000|0000|0000|0000| AFFFFF 1010|1111|1111|1111|1111|1111|

William Sandqvist william@kth.se

slide-26
SLIDE 26

Change the address range! ?

Change the address range to 980000 – AFFFFF ? 980000 1001|1000|0000|0000|0000|0000| AFFFFF 1010|1111|1111|1111|1111|1111|

William Sandqvist william@kth.se

”10|011” → ”3” ”10|101” → ”5”

slide-27
SLIDE 27

Change the address range! ?

Change the address range to 980000 – AFFFFF ? 980000 1001|1000|0000|0000|0000|0000| AFFFFF 1010|1111|1111|1111|1111|1111|

William Sandqvist william@kth.se

”10|011” → ”3” ”10|101” → ”5”

Micro- processor

slide-28
SLIDE 28

Change the address range! ?

Change the address range to 480000 – 5FFFFF ?

William Sandqvist william@kth.se

slide-29
SLIDE 29

Change the address range! ?

Change the address range to 480000 – 5FFFFF ?

William Sandqvist william@kth.se

480000 0100|1000|0000|0000|0000|0000| 5FFFFF 0101|1111|1111|1111|1111|1111|

slide-30
SLIDE 30

Change the address range! ?

Change the address range to 480000 – 5FFFFF ?

William Sandqvist william@kth.se

480000 0100|1000|0000|0000|0000|0000| 5FFFFF 0101|1111|1111|1111|1111|1111| ”01|001” → ”1” ”01|011” → ”3”

slide-31
SLIDE 31

Change the address range! ?

Change the address range to 480000 – 5FFFFF ?

William Sandqvist william@kth.se

480000 0100|1000|0000|0000|0000|0000| 5FFFFF 0101|1111|1111|1111|1111|1111| ”01|001” → ”1” ”01|011” → ”3”

Micro- processor

slide-32
SLIDE 32

Change the address range! ?

Change the address range to 480000 – 5FFFFF ?

William Sandqvist william@kth.se

480000 0100|1000|0000|0000|0000|0000| 5FFFFF 0101|1111|1111|1111|1111|1111| ”01|001” → ”1” ”01|011” → ”3”

Micro- processor

slide-33
SLIDE 33

ROM 00 00 00…?

William Sandqvist william@kth.se

Most often a processor reads its first instruction from address 0, then there must be a ROM at that address. Suppose a ROM 2M × 16 bitar address range 000000 … and forward. ROM Chip 512k×8.

  • How many chips are needed?
  • How is the decoder connected?
  • How are the memory chips connected?
  • Which is the address area for the ROM expressed in hexadecimal

numbers.

slide-34
SLIDE 34

ROM 00 00 00…?

William Sandqvist william@kth.se

Most often a processor reads its first instruction from address 0, then there must be a ROM at that address. Suppose a ROM 2M × 16 bitar address range 000000 … and forward. ROM Chip 512k×8.

  • How many chips are needed?
  • How is the decoder connected?
  • How are the memory chips connected?
  • Which is the address area for the ROM expressed in hexadecimal

numbers. Memory: N = 2 M (4⋅512k) word is M = 16 bitar Memory chip: p = 512 k word is q = 8 bitar

  • Number of rows r ≤ N/p = 4⋅512k/512k = 4
  • Number of columns k ≥ M/q = 16/8 = 2
  • Number of chips K = r × k = 4 × 2 = 8
slide-35
SLIDE 35

ROM connections?

William Sandqvist william@kth.se

Micro- processor

slide-36
SLIDE 36

ROM connections?

William Sandqvist william@kth.se

Micro- processor

OE RD =

slide-37
SLIDE 37

Decoder connection?

William Sandqvist william@kth.se

Micro- processor

slide-38
SLIDE 38

Decoder connection?

William Sandqvist william@kth.se

Micro- processor

slide-39
SLIDE 39

Decoder ROM adresses?

William Sandqvist william@kth.se

slide-40
SLIDE 40

Decoder ROM adresses?

William Sandqvist william@kth.se

00ab|cmmm|mmmm|mmmm|mmmm|mmmm 0000|0000|0|0|0|0 - 0000|0111|F|F|F|F 000000-07FFFF 0000|1000|0|0|0|0 - 0000|1111|F|F|F|F 080000-0FFFFF 0001|0000|0|0|0|0 - 0001|0111|F|F|F|F 100000-17FFFF 0001|1000|0|0|0|0 - 0001|1111|F|F|F|F 180000-1FFFFF

slide-41
SLIDE 41

Decoder ROM adresses?

William Sandqvist william@kth.se

00ab|cmmm|mmmm|mmmm|mmmm|mmmm 0000|0000|0|0|0|0 - 0000|0111|F|F|F|F 000000-07FFFF 0000|1000|0|0|0|0 - 0000|1111|F|F|F|F 080000-0FFFFF 0001|0000|0|0|0|0 - 0001|0111|F|F|F|F 100000-17FFFF 0001|1000|0|0|0|0 - 0001|1111|F|F|F|F 180000-1FFFFF Totaly ROM 000000 – 1FFFFF

ROM

slide-42
SLIDE 42

Decoder SRAM+I/O adresses?

William Sandqvist william@kth.se

00ab|cmmm|mmmm|mmmm|mmmm|mmmm 0010|0000|0|0|0|0 - 0010|0111|F|F|F|F 200000-27FFFF 0010|1000|0|0|0|0 - 0010|1111|F|F|F|F 280000-2FFFFF 0011|0000|0|0|0|0 - 0011|0111|F|F|F|F 300000-37FFFF 0011|1000|0|0|0|0 - 0011|1111|F|F|F|F 380000-3FFFFF

slide-43
SLIDE 43

Decoder SRAM+I/O adresses?

William Sandqvist william@kth.se

00ab|cmmm|mmmm|mmmm|mmmm|mmmm 0010|0000|0|0|0|0 - 0010|0111|F|F|F|F 200000-27FFFF 0010|1000|0|0|0|0 - 0010|1111|F|F|F|F 280000-2FFFFF 0011|0000|0|0|0|0 - 0011|0111|F|F|F|F 300000-37FFFF 0011|1000|0|0|0|0 - 0011|1111|F|F|F|F 380000-3FFFFF I/O

slide-44
SLIDE 44

Decoder SRAM+I/O adresses?

William Sandqvist william@kth.se

00ab|cmmm|mmmm|mmmm|mmmm|mmmm 0010|0000|0|0|0|0 - 0010|0111|F|F|F|F 200000-27FFFF 0010|1000|0|0|0|0 - 0010|1111|F|F|F|F 280000-2FFFFF 0011|0000|0|0|0|0 - 0011|0111|F|F|F|F 300000-37FFFF 0011|1000|0|0|0|0 - 0011|1111|F|F|F|F 380000-3FFFFF

SRAM

I/O

slide-45
SLIDE 45

Decoder SRAM+I/O adresser?

William Sandqvist william@kth.se

00ab|cmmm|mmmm|mmmm|mmmm|mmmm 0010|0000|0|0|0|0 - 0010|0111|F|F|F|F 200000-27FFFF 0010|1000|0|0|0|0 - 0010|1111|F|F|F|F 280000-2FFFFF 0011|0000|0|0|0|0 - 0011|0111|F|F|F|F 300000-37FFFF 0011|1000|0|0|0|0 - 0011|1111|F|F|F|F 380000-3FFFFF Possible SRAM+I/O adresser 200000 – 3FFFFF

SRAM

I/O

slide-46
SLIDE 46

Ex 12.3 Input/Output

Peripheral circuit connected as a small RAM. Only the 8 least significant bits

  • f data are used. CS Chip Select enables the chip.

Connect a 8 register memory-mapped peripheral device (I/O) to a CPU. The CPU has 16-bit data bus (only 8 bits are used by the chip), and a 24 bit address bus. Use a 3:8-decoder and if needed

  • gates. The peripheral device must be connected so that it can

register addresses 0x200010 … 0x200017.

William Sandqvist william@kth.se

Peripherals, I/O, are often connected to a CPU as if they were memory chips (though with only a few "memory cells").

  • Eg. a real time clock chip - keeps track
  • f time and date. It is controlled/read

from the 8 built-in registers.

slide-47
SLIDE 47

Ex 12.3 Input/Output

William Sandqvist william@kth.se

I/O adresses, at the decoder output ”4”, 200000 – 27FFFF according to the earlier task.

Micro- processor

slide-48
SLIDE 48

Decoding

0x200010 = 0010|0.000|0000|0000|0001|0.000 0x200011 = 0010|0.000|0000|0000|0001|0.001 0x200012 = 0010|0.000|0000|0000|0001|0.010 0x200013 = 0010|0.000|0000|0000|0001|0.011 0x200014 = 0010|0.000|0000|0000|0001|0.100 0x200015 = 0010|0.000|0000|0000|0001|0.101 0x200016 = 0010|0.000|0000|0000|0001|0.110 0x200017 = 0010|0.000|0000|0000|0001|0.111

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

A A A A A A A A A A A A A A A A ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ RS2RS1RS0

William Sandqvist william@kth.se

Decoder output ”4” Remains to decode:

slide-49
SLIDE 49

Connections

William Sandqvist william@kth.se

Micro- processor

slide-50
SLIDE 50

Connections

William Sandqvist william@kth.se

Micro- processor

?

A bit too many inputs?

slide-51
SLIDE 51

incomplete decoding?

William Sandqvist william@kth.se

Addressing becomes ambiguous!

slide-52
SLIDE 52

incomplete decoding?

William Sandqvist william@kth.se

Addressing becomes ambiguous!

For full decoding, we used a &-gate with 17 inputs! Sometimes you make a partial

  • decoding. Then you omits address signals and thus can use a gate with fewer

inputs. I/O device addressing is ambiguous, it can be addressed with many different addresses, but the one who writes the program code determines which addresses to use. The main thing is to ensure that the I/O device addresses do not collide with any other device addresses.

slide-53
SLIDE 53

volatile ?

William Sandqvist william@kth.se

slide-54
SLIDE 54

volatile ?

William Sandqvist william@kth.se

Since the I/O devices are not true memories - it can seem as if the content can be changed "by itself" - so when you write computer programs you need to "help" the compiler to understand this. It could be done by declaring these adresses as volatile. This, you will meet in Computer Engineering course.

slide-55
SLIDE 55

Rehearsal before the exam

slide-56
SLIDE 56

Ex 6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f

slide-57
SLIDE 57

6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f ? ? ) , , , , (

1 2 3 4

= = f f x x x x x f ? ) , , , , (

1 2 3 4

= f x x x x x f

slide-58
SLIDE 58

6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f ? ? ) , , , , (

1 2 3 4

= = f f x x x x x f ? ) , , , , (

1 2 3 4

= f x x x x x f

slide-59
SLIDE 59

6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f ? ? ) , , , , (

1 2 3 4

= = f f x x x x x f ? ) , , , , (

1 2 3 4

= f x x x x x f

2 4 2 3 2 3 4

x x x x x x x x x f + + =

slide-60
SLIDE 60

6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f ? ? ) , , , , (

1 2 3 4

= = f f x x x x x f ? ) , , , , (

1 2 3 4

= f x x x x x f

slide-61
SLIDE 61

6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f ? ? ) , , , , (

1 2 3 4

= = f f x x x x x f ? ) , , , , (

1 2 3 4

= f x x x x x f

slide-62
SLIDE 62

6.10 Combinatorial circuit 5 variables

William Sandqvist william@kth.se

= ) 27 , 26 , 25 , 24 , 18 , 16 , 15 , 14 , 13 , 12 , 11 , 9 ( ) , , , , (

1 2 3 4

m x x x x x f ? ? ) , , , , (

1 2 3 4

= = f f x x x x x f ? ) , , , , (

1 2 3 4

= f x x x x x f

2 4 2 4 3 3 4

x x x x x x x x x f + + + =

slide-63
SLIDE 63

Ex 8.1 Binary squarer

William Sandqvist william@kth.se

Bring out the Boolean equations for a network at minimal SP-form which transforms a three-bit binary coded number X (x2, x1, x0) to a binary coded six bit number U (u5, u4, u3, u2, u1, u0) which is equal to the square of the number U = X 2.

slide-64
SLIDE 64

8.1 Truth table

William Sandqvist william@kth.se

slide-65
SLIDE 65

8.1 Karnaugh map

William Sandqvist william@kth.se

Of truth table it shows that u1 always is equal to 0. u1 uotput could therefore be connected to 0V (ground) so it will get the constant 0. One can further see that u0 always is the same as x0. u0 output can therfore be connected directly to x0 input.

slide-66
SLIDE 66

Mechanical "squarer"

slide-67
SLIDE 67

Brock institute for advaced studies function generator

slide-68
SLIDE 68
  • Ex. 10.9 Stepper motor controller

William Sandqvist william@kth.se

A stepper motor is a digital component that is driven by pulses. Stepper motors are usually connected to a counter counting Gray code. Figure calculator also has a mode-input, m1m0. m1m0 = 00 → Reset (fixed position) m1m0 = 01 → count up (cw) m1m0 = 10 → count down (ccw) m1m0 = 11 → Preset (another fixed position)

slide-69
SLIDE 69

10.9 State diagram

William Sandqvist william@kth.se

Sometimes you write boolean conditions instead of just the numbers at the arrows. In the figure, both the condition and numbers are used. m1m0 = 00 → Reset (fixed position) m1m0 = 01 → count up (cw) m1m0 = 10 → count down (ccw) m1m0 = 11 → Preset (another fixed position)

slide-70
SLIDE 70

10.9 State table and next state decoder

William Sandqvist william@kth.se

slide-71
SLIDE 71

William Sandqvist william@kth.se

BV 10.5

One aproach for implementing integer division is to perform repeated subtraction as indicated in pseudo-code. Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while; a) Give an ASM chart that represents the pseudo-code. b) Show the datapath circuit corresponding to part (a). c) Give the ASM chart for the control circuit corresponding to part (b).

slide-72
SLIDE 72

Algorithmic State Machine

ASM method consists of the following steps:

  • 1. Creating an algorithm in pseudo code, which describes the

desired circuit function.

  • 2. Transform the pseudocode to an ASM diagram.
  • 3. Design a data flow diagram from the ASM diagram.
  • 4. Create a detailed ASM diagram from the data flow diagram.
  • 5. Design the control logic based on the detailed ASM chart.

William Sandqvist william@kth.se

slide-73
SLIDE 73

Figure 8.86. Elements used in ASM charts.

Output signals

  • r actions

(Moore type) State name Condition expression 0 (False) 1 (True) Conditional outputs

  • r actions (Mealy type)

(a) State box (b) Decision box (c) Conditional output box

slide-74
SLIDE 74

William Sandqvist william@kth.se

slide-75
SLIDE 75

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

slide-76
SLIDE 76

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

RESET

Q←0 Start? Load R←A Load B

S1

1

slide-77
SLIDE 77

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

Wait for start! RESET

Q←0 Start? Load R←A Load B

S1

1

slide-78
SLIDE 78

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

Wait for start! RESET

Q←0 Start? Load R←A Load B

S1

1

? ≥ − B R

S2

1 R←R-B Q←Q+1

slide-79
SLIDE 79

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

Wait for start! RESET

Q←0 Start? Load R←A Load B

S1

1

? ≥ − B R

S2

1 R←R-B Q←Q+1

Subtract!

slide-80
SLIDE 80

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

Wait for start! RESET

Q←0 Start? Load R←A Load B

S1

1

? ≥ − B R

S2

1 R←R-B Q←Q+1

Subtract! Done?

slide-81
SLIDE 81

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

RESET

Q←0 Start? Load R←A Load B

S1

1

? ≥ − B R

S2

1 R←R-B Q←Q+1

slide-82
SLIDE 82

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

RESET

Q←0 Start? Load R←A Load B

S1

1

? ≥ − B R

S2

1 R←R-B Q←Q+1

Klar

Start?

S3

1

slide-83
SLIDE 83

William Sandqvist william@kth.se

BV 10.5 ASM chart

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

RESET

Q←0 Start? Load R←A Load B

S1

1

? ≥ − B R

S2

1 R←R-B Q←Q+1

Wait for Start to be released, to restart.

Done

Start?

S3

1

slide-84
SLIDE 84

William Sandqvist william@kth.se

Do you remember?

) (

1 2 3 3 3 4

s s s s Z s N c c V Y X + + + = = ⊕ = − V N Y X V N Z V N Z Y X V N Z Y X V N Y X Z Y X ⊕ ⇒ ≥ ⊕ ⋅ = ⊕ + ⇒ > ⊕ + ⇒ ≤ ⊕ ⇒ < = ⇒ = ) ( 1

This is how a computer can do the most common comparisons …

slide-85
SLIDE 85

William Sandqvist william@kth.se

BV 10.5 datapath circuit

Q = 0; R = A While ((R – B) ≥ 0) do R = R – B; Q = Q + 1; End while;

slide-86
SLIDE 86

William Sandqvist william@kth.se

BV 10.5 ASM control

RESET

LoadQ LoadB RBdiff_sel=0 LoadR_A

Start?

S1

1

S2

1 LoadR_A

Done

Start?

S3

1

RBdiff_sel=1 R_GE_B

slide-87
SLIDE 87

William Sandqvist william@kth.se