45
Ch. 7 Memory and Programmable Logic

Ch. 7 Memory and Programmable Logic. Random-Access Memory Memory Decoding Error Detection and Correction Read-Only Memory Programmable Logic

  • View
    254

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Ch. 7

Memory and Programmable Logic

Page 2: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Memory and Programmable Logic

Random-Access MemoryMemory DecodingError Detection and CorrectionRead-Only MemoryProgrammable Logic ArrayProgrammable Array LogicSequential Programmable Devices

Page 3: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Memory

Memory – A device to which binary information is transferred

for storage.Type of memory

– random access memory , RAM– read-only memory, ROM

Write operation– Storing new information into memory

Read operation– Transferring the stored information out of memory

Page 4: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

RAM

RAM– The time it takes to transfer information to or from

any desired random location is always the same

Storage unit–byte– byte : 8 bits

– Length of a word : multiple of 8 bits

– word : represent a number, an instruction, alphanumeric character

Capacity of memory–total number of bytes

Page 5: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Block diagram of memory unit

k address lines :select one particular word

read, write : specify the direction of transfer

n data input line :provide the information to be stored in memoryn data output line :supplying the information coming out of memory

Page 6: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Capacity of memory

Range of in memory size– 210~232 words

bytes– K=210 、 M=220 、 G=230 。– 64K=216 、 2M=221 、 4G=232 。

Memory 1K x 16– 10 bits address , 16 bits in each word

Determine the no. of bits for address

mk 2 k: no. of address bitsm: total number of words

Page 7: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Control inputs to memory chip

memory enable read/write memory

operation 0 x None 1 0 Write to select

word 1 1 read from

selectd word

Page 8: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Memory cycle timing waveforms

access time– the time required to select a word and read it

cycle time– the time required to complete a write cycle

access time 、 cycle time– equal to a fixed number of CPU clock

See Fig. 7-4

Page 9: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic
Page 10: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Types of memory

The mode of access of a memory– RAM-volatile

• Static RAM(SRAM)– internal latch – easier to used and shorter read and write time

• Dynamic RAM(DRAM) – electric charges on capacitor– less power consumption– larger storage capacity

– ROM-nonvolatile • Read/write time depend on the distance between

the magnetic reader/writer and the data

Page 11: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Memory Decoding

Decoder – select the memory word specified by the input

address

2-dimensional coincident decoding is a more efficient decoding scheme for large memories

Page 12: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Memory cell

One bit memory cell

Page 13: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

4X4 RAM

Page 14: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Coincident Decoding- two-dimensional selection scheme

Decoder with k input and 2k output requires 2k AND gates with k input

k input decoder can be implemented by two k/2 input decoders with one for column and another for row

e.g., 10×1024 decoder can be implemented by two 5×32 decoders

Page 15: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Example for two-dimensional decoder

Page 16: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Address multiplexing64K-word memory

Page 17: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Read-Only Memory

ROM : permanent binary information is stored

k input, n output ROM

Page 18: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

ROM

No data inputIntegrated circuit ROM have one or more

enable inputSometimes come with three-state outputs

to facilitate the construction of large arrays of ROM

Page 19: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Internal logic of 32X8 ROM

Page 20: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

ROM truth table

Table 7-3 32×8 ROM truth table 輸入 輸出

I4 I3 I2 I1 I0 A7 A6 A5 A4 A3 A2 A1 A0

0 0 0 0 0 1 0 1 1 0 1 1 0

0 0 0 0 1 0 0 0 1 1 1 0 1

0 0 0 1 0 1 1 0 0 0 1 0 1

0 0 0 1 1 1 0 1 1 0 0 1 0 . . .

.

.

.

1 1 1 0 0 0 0 0 0 1 0 0 1

1 1 1 0 1 1 1 1 0 0 0 1 0

1 1 1 1 0 0 1 0 0 1 0 1 0

1 1 1 1 1

0 0 1 1 0 0 1 1

Page 21: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Programmomg the ROM according to Taable 7-3

× denote a connection in place of a dot used for permanent connection

Page 22: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Example 7-1

輸入 輸出

A2 A1 A0 B5 B4 B3 B2 B1 B0

十進位

0 0 0 0 0 0 0 0 0 0

0 0 1 0 0 0 0 0 1 1

0 1 0 0 0 0 1 0 0 4

0 1 1 0 0 1 0 0 1 9

1 0 0 0 1 0 0 0 0 16

1 0 1 0 1 1 0 0 1 25

1 1 0 1 0 0 1 0 0 36

1 1 1

1 1 0 0 0 1

49

Design a combinational circuit with 3-input using a ROM.Output = square(input)

Page 23: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

ROM implementation of Example 7-1

Page 24: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Types of ROMs

The required path in a ROM may be programmed in four different ways. – mask programming (mask ROM)

• Mask is done by Fab. company during the last fabrication

• Customer must fill out the truth table

• High cost

– programmable read-only memory(PROM)• allows users to program in Lab.

• the program is irreversible

Page 25: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Types of ROMs

– Erasable PROM(EPROM)• by ultraviolet light

– electrically-erasable PROM(EEPROM or E²PROM) ,

• by electrical signal • can be erased without removing it from tis socket

Page 26: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Types of PLD (Programmable Logic Device)

Page 27: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Programmable Logic Array (PLA)

similar to PROM does not provide full decoding and does

not generate all the mintermsdecoder is replaced by an array of AND

gate

Page 28: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

PLA with 3 inputs, 4 product terms, and two outputs

Page 29: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

PLA Programming Table

PLA Programming Table consists of three sections

– 1st, list the product terms numerically

– 2nd, specify the required path between inputs and AND gates

– 3rd, specifies the paths between the AND and OR gates

outputs

inputs (T) (C) Product

term A B C F1 F2

BA 1 1 0 - 1 -

AC 2 1 - 1 1 1

BC 3 - 1 1 - 1

CBA 4 0 1 0

1 -

Page 30: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Example 7-2

Implement the following two Boolean functions with a PLA:

Simplified by K-map :

)7,6,5,0(),,(

)4,2,1,0(),,(

2

1

CBAF

CBAF

CBAACABF

BCACABF

2

1 )(

Page 31: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

Solution of Example 7-2

Page 32: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

可規劃陣列邏輯

可規劃陣列邏輯是一個具有一固定 OR 陣列與一可規劃AND 陣列的可規劃邏輯裝置。由於僅有 AND 閘可規劃,所以此種 PAL 較容易規劃,但不像 PLA 那樣的適用。

典型的 PAL 積體電路可能有 8 個輸入, 8 個輸出及 8個區域。而每個區域均有一組 8 個寬度的 AND-OR 閘,至於輸出端子,有時則用三態緩衝器或是反相器來區分。

當用 PAL 設計時,布林函數必須簡化成可適合每一部份,不像 PLA ,一個乘積項不可能由兩個或更多的 OR閘來分享。因此,每一個函數均可自行簡化,而不用考慮共用的乘積項。而每一區域內的乘積項數目是固定的,若該函數中乘積項數目過大時,那麼就可能需要兩個區域來執行一個布林函數。

Page 33: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

PAL 具有 4 個輸入 4 個輸出及 3 個寬度的 AND-OR 結構

Page 34: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

用 PAL 設計組合邏輯電路

布林函數

化簡後之布林函數

PAL 規劃表除了 AND 閘需要規劃外,其餘均與 PLA 的規劃表相似。

)13,12,8,2,1(),,,(

)15,11,10,8,7,6,5,4,3,2,0(),,,(

)15,14,13,12,11,10,9,8,7(D)C,B,x(A,

)13,12,2(),,,(

DCBAz

DCBAy

DCBAw

DCBADCAw

DCBADCADCBACABz

DBCDBAy

BCDAx

DCBACABw

Page 35: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

PAL 規劃表

A N D 輸 入 成 績 項

A B C D W

1 1 1 - - -

2 0 0 0 0 -

3 - - - - -

DCBACABw

4 1 - - - -

5 - 1 1 1 -

6 - - - - -

BCDAx

7 0 1 - - -

8 - - 1 1 -

9 - 0 - 0 -

DBCDBAy

1 0 - - - - 1

1 1 0 - 0 0 -

1 2

1 0 0 1 -

DCBADCAwz

Page 36: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

規劃表所指定的 PAL 熔絲路徑圖

Page 37: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

循序可規劃裝置數位系統常用正反器及邏輯閘來設計電路。 PLD 只包含了邏輯閘,因此當設計數位系統

時,就有必要包括額外的正反器循序可規劃裝置則同時包含了邏輯閘與正反

器。因此,此裝置可以被規劃成執行各種不同的循序電路功能。

我們將它分成三個類型來描述,而不深入探討其詳細的構造。 1. 循序 (或簡單 )可規劃邏輯裝置 (SPLD)2. 複雜的可規劃邏輯裝置 (CPLD)3. 現場可規劃邏輯陣列 (FPGA)

Page 38: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

SPLD

SPLD 在積體電路元件內除了有 AND-OR 陣列外,還包括了正反器,一個循序電路就如圖 7-18 所示。

一個 PAL 或 PLA 被修改就是利用包含從暫存器連接到一些正反器的變動。至於電路的輸出則可以由 OR閘或正反器的輸出得到。

最常被用到的 SPLD 型態是用 D 型正反器和 PAL 組合在一起。

SPLD 的每個部份被稱做 marcocell ,一個marcocell 就是一個電路,它包含一個積之和的組合邏輯函數及一個可自由選擇的正反器。

Page 39: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic
Page 40: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

現場可規劃邏輯序列 (FPLS)

第一種可規劃裝置被發展出來,主要是為了要製作循序電路

典型的 FPLS 則是由一個 PLA 及幾個正反器的輸出所組成的。而這些正反器適合被規劃成 JK 型或 D 型正反器的操作。

FPLS 並不是很成功的。

Page 41: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

macrocell

一個典型的 SPLD IC,它的包裝裡就有 8個到 10 個 macrocell,所有正反器都被連接到共同時脈輸入,同時所有三態緩衝器都由 OE輸入來控制。

macrocell可以有其他規劃特色,典型的規劃是可以自由選擇的。包括使用或不使用此正反器的能力,選擇時脈邊緣的極性,暫存器的清除與設定的選擇,以及輸出是真或假

的選擇等。

Page 42: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

CPLD

一個 CPLD 是收集一些個別的 PLD 把它們放在一個單獨的積體電路上。

一個普通的 CPLD 結構如圖 7-20 所示。它透過一個可規劃的開關矩陣將多重的 PLD 交互連接。輸出 / 輸入方塊提供到 IC 接腳的連接。每支 I/O 接腳則是由三態緩衝器推導出來的,它可以被規劃成輸入或是輸出,而開關矩陣接受從 I/O 方塊來的輸入,且直接將它傳送至個別的 macrocell 。

Page 43: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic
Page 44: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

FPGA

現場可規劃邏輯陣列 (FPGA) 是一個 VLSI 電路

VLSI 設計中,最基本的元件就是邏輯陣列 典型的 FPGA 包含上百個或上千個邏輯方塊

陣列,且由可規劃的輸入及輸出方塊所圍繞,且使用可規劃交互連接將它們連接在一起。

典型的 FPGA 邏輯方塊包含查看表格、多工器、邏輯閘及正反器。 – 此查看表格是儲存在 SRAM 內的真值表,且提供

此邏輯方塊一個組合邏輯電路函數。

Page 45: Ch. 7 Memory and Programmable Logic.  Random-Access Memory  Memory Decoding  Error Detection and Correction  Read-Only Memory  Programmable Logic

使用 RAM 來代替 ROM 的好處就是可以將規劃好的真值表寫入記憶體。而缺點就是記憶體容易變的。且當電源重新開始時,則查看表格的內容必須重新載入,而程式可由主電腦或另一個 PROM下載。程式則一直被保留,直到 FPGA 重新被規劃或是電源被關掉。每次電源被打開,這裝置就必須被重新規劃。在程式中藉由使用不同的邏輯製作,來重新規劃 FPGA ,此法可被用在不同的應用中

用 PLD , CPLD或是 FPGA來設計電路則需要額外的電腦輔助設計工具 (CAD)來製造合成程序。可利用的工具如用產生圖形輸入包裝及硬體描述語言(HDL),例如 ABEL , VHDL 及 VERILOG。合成工具則產生架構及連接邏輯方塊以符合用 HDL描述的高階設計。