54
Lecture 10: Sequential Blocks Arrays E85 Digital Design & Computer Engineering

Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10 Address Data N Array

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10: Sequential BlocksArrays

E85 Digital Design & Computer Engineering

Page 2: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <2> Digital Design and Computer Architecture: ARM® Edition © 2015

Lecture 8

• Counters• Shift Registers• Memory Arrays– RAM– ROM

• Logic Arrays– PLAs– FPGAs

Page 3: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <3> Digital Design and Computer Architecture: ARM® Edition © 2015

Q

CLK

ResetN

+ N

1

CLK

Reset

N

NQN

r

Symbol Implementation

• Increments on each clock edge• Used to cycle through numbers. For example,

– 000, 001, 010, 011, 100, 101, 110, 111, 000, 001…

• Example uses:– Digital clock displays– Program counter: keeps track of current instruction executing

Counters

Page 4: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <4> Digital Design and Computer Architecture: ARM® Edition © 2015

Q

CLK

ResetN

+ N

1

CLK

Reset

N

NQN

r

Symbol Implementation

module counter (input logic clk, reset,output logic [N-1:0] q);

logic [N-1:0] nextq;

// registeralways_ff @(posedge clk, posedge reset) if (reset) q <= 0;else q <= nextq;

// next stateassign nextq = q + 1;

endmodule

Counter Verilog (FSM style)

Page 5: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <5> Digital Design and Computer Architecture: ARM® Edition © 2015

Q

CLK

ResetN

+ N

1

CLK

Reset

N

NQN

r

Symbol Implementation

module counter (input logic clk, reset,output logic [N-1:0] q);

always_ff @(posedge clk, posedge reset) if (reset) q <= 0;else q <= q+1;

endmodule

Counter Verilog (better idiom)

Page 6: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <6> Digital Design and Computer Architecture: ARM® Edition © 2015

• Most significant bit of an N-bit counter toggles every 2N

cycles.

• Useful for slowing a clock. Ex: blink an LED

• Example: 50 MHz clock, 24-bit counter• 2.98 Hz

Divide-by-2N Counter

Page 7: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <7> Digital Design and Computer Architecture: ARM® Edition © 2015

• N-bit counter

• Add p on each cycle, instead of 1

• Most significant bit toggles at fout = fclk * p / 2N

• Example: fclk = 50 MHz clock

• How to generate a fout = 200 Hz signal?

• p/2N = 200 / 50 MHz

• Try N = 24, p = 67 è fout = 199.676 Hz

• Or N = 32, p = 17179 è fout = 199.990 Hz

Digitally Controlled Oscillator

Page 8: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <8> Digital Design and Computer Architecture: ARM® Edition © 2015

NQ

Sin Sout

CLKSin Sout

Q0 Q1 QN-1Q2

Implementation:

• Shift a new bit in on each clock edge• Shift a bit out on each clock edge• Serial-to-parallel converter: converts serial input (Sin) to

parallel output (Q0:N-1)

Shift Registers

Symbol:

Page 9: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <9> Digital Design and Computer Architecture: ARM® Edition © 2015

Clk01

01

01

01

D0 D1 DN-1D2

Q0 Q1 QN-1Q2

Sin Sout

Load

• When Load = 1, acts as a normal N-bit register• When Load = 0, acts as a shift register• Now can act as a serial-to-parallel converter (Sin to Q0:N-1) or

a parallel-to-serial converter (D0:N-1 to Sout)

Shift Register with Parallel Load

Page 10: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <10> Digital Design and Computer Architecture: ARM® Edition © 2015

module shiftreg(input logic clk,input logic load, sin,input logic [N-1:0] d,output logic [N-1:0] q,output logic sout);

always_ff @(posedge clk) if (load) q <= d;else q <= {q[N-2:0], sin};

assign sout = q[N-1];endmodule

Shift Register Verilog Idiom

Clk01

01

01

01

D0 D1 DN-1D2

Q0 Q1 QN-1Q2

Sin Sout

Load

Page 11: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <11> Digital Design and Computer Architecture: ARM® Edition © 2015

Address

Data

ArrayN

M

• Efficiently store large amounts of data• 3 common types:

– Dynamic random access memory (DRAM)

– Static random access memory (SRAM)– Read only memory (ROM)

• M-bit data value read/ written at each unique N-bit address

Memory Arrays

Page 12: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <12> Digital Design and Computer Architecture: ARM® Edition © 2015

Address

Data

ArrayN

M

Address Data11100100

depth

0 1 01 0 01 1 00 1 1

width

Address

Data

Array2

3

• 2-dimensional array of bit cells

• Each bit cell stores one bit

• N address bits and M data bits:– 2N rows and M columns

– Depth: number of rows (number of words)

– Width: number of columns (size of word)

– Array size: depth × width = 2N × M

Memory Arrays

Page 13: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <13> Digital Design and Computer Architecture: ARM® Edition © 2015

Address Data11100100

depth

0 1 01 0 01 1 00 1 1

width

Address

Data

Array2

3

• 22 × 3-bit array• Number of words: 4• Word size: 3-bits• For example, the 3-bit word stored at address 10 is 100

Memory Array Example

Page 14: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <14> Digital Design and Computer Architecture: ARM® Edition © 2015

Address

Data

1024-word x32-bitArray

10

32

Memory Arrays

Page 15: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <15> Digital Design and Computer Architecture: ARM® Edition © 2015

stored bit

wordlinebitline

stored bit = 0

wordline = 1

stored bit = 1

stored bit = 0

stored bit = 1

bitline =

(a) (b)

wordline = 1

wordline = 0

wordline = 0

bitline =

bitline =

bitline =

Memory Array Bit Cells

Page 16: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <16> Digital Design and Computer Architecture: ARM® Edition © 2015

stored bit

wordlinebitline

stored bit = 0

wordline = 1

stored bit = 1

stored bit = 0

stored bit = 1

bitline =

(a) (b)

wordline = 1

wordline = 0

wordline = 0

bitline =

bitline =

bitline = 0

1

Z

Z

Memory Array Bit Cells

Page 17: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <17> Digital Design and Computer Architecture: ARM® Edition © 2015

wordline311

10

2:4Decoder

Address

01

00

storedbit = 0wordline2

wordline1

wordline0

storedbit = 1

storedbit = 0

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

bitline2 bitline1 bitline0

Data2 Data1 Data0

2

• Wordline: – like an enable

– single row in memory array read/written

– corresponds to unique address

– only one wordline HIGH at once

Memory Array

Page 18: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <18> Digital Design and Computer Architecture: ARM® Edition © 2015

• Random access memory (RAM): volatile• Read only memory (ROM): nonvolatile

Types of Memory

Page 19: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <19> Digital Design and Computer Architecture: ARM® Edition © 2015

• Volatile: loses its data when power off

• Read and written quickly

• Main memory in your computer is RAM (DRAM)

Historically called random access memory because any data word accessed as easily as any other (in contrast to sequential access memories such as a tape recorder)

RAM: Random Access Memory

Page 20: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <20> Digital Design and Computer Architecture: ARM® Edition © 2015

• Nonvolatile: retains data when power off

• Read quickly, but writing is impossible or

slow

• Flash memory in cameras, thumb drives, and

digital cameras are all ROMs

Historically called read only memory because ROMs were

written at manufacturing time or by burning fuses. Once

ROM was configured, it could not be written again. This is

no longer the case for Flash memory and other types of

ROMs.

ROM: Read Only Memory

Page 21: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <21> Digital Design and Computer Architecture: ARM® Edition © 2015

• DRAM (Dynamic random access memory)

• SRAM (Static random access memory)

• Differ in how they store data:– DRAM uses a capacitor

– SRAM uses cross-coupled inverters

Types of RAM

Page 22: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <22> Digital Design and Computer Architecture: ARM® Edition © 2015

• Invented DRAM in 1966 at IBM

• Others were skeptical that the idea would work

• By the mid-1970’s DRAM in virtually all computers

Robert Dennard, 1932 -

Page 23: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <23> Digital Design and Computer Architecture: ARM® Edition © 2015

stored bit

wordlinebitline

wordline

bitline

storedbit

• Data bits stored on capacitor

• Dynamic because the value needs to be refreshed (rewritten) periodically and after read:– Charge leakage from the capacitor degrades the value

– Reading destroys the stored value

DRAM

Page 24: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <24> Digital Design and Computer Architecture: ARM® Edition © 2015

wordline

bitline

wordline

bitline

+ +storedbit = 1

storedbit = 0

DRAM

Page 25: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <25> Digital Design and Computer Architecture: ARM® Edition © 2015

stored bit

wordlinebitline

wordlinebitline bitline

SRAM

Page 26: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <26> Digital Design and Computer Architecture: ARM® Edition © 2015

wordline311

10

2:4Decoder

Address

01

00

storedbit = 0wordline2

wordline1

wordline0

storedbit = 1

storedbit = 0

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

bitline2 bitline1 bitline0

Data2 Data1 Data0

2

wordlinebitline bitline

wordline

bitline

DRAM bit cell: SRAM bit cell:

Memory Arrays Review

Page 27: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <27> Digital Design and Computer Architecture: ARM® Edition © 2015

11

10

2:4 Decoder

Address

Data0Data1Data2

01

00

2

wordline

bitline

wordline

bitline

bit cellcontaining 0

bit cellcontaining 1

ROM: Dot Notation

Page 28: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <28> Digital Design and Computer Architecture: ARM® Edition © 2015

Types of ROMsType Name DescriptionROM Read Only Memory Chip is hardwired with presence or absence of

transistors. Changing requires building a new chip.

PROM Programmable ROM Fuses in series with each transistor are blown to program bits. Can’t be changed after programming.

EPROM Electrically Programmable ROM

Charge is stored on a floating gate to activate or deactivate transistor. Erasing requires exposure to UV light.

EEPROM Electrically ErasableProgrammable ROM

Like EPROM, but erasing can be done electrically.

Flash Flash Memory Like EEPROM, but erasing is done on large blocks to amortize cost of erase circuit. Low cost per bit, dominates nonvolatile storage today.

Page 29: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <29> Digital Design and Computer Architecture: ARM® Edition © 2015

• Developed memories and high speed

circuits at Toshiba, 1971-1994

• Invented Flash memory as an

unauthorized project pursued during

nights and weekends in the late 1970’s

• The process of erasing the memory

reminded him of the flash of a camera

• Toshiba slow to commercialize the

idea; Intel was first to market in 1988

• Flash has grown into a $25 billion per

year market

Fujio Masuoka, 1944 -

Page 30: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <30> Digital Design and Computer Architecture: ARM® Edition © 2015

11

10

2:4 Decoder

Address

Data0Data1Data2

01

00

2

Address Data11100100

depth

0 1 01 0 01 1 00 1 1

width

ROM Storage

Page 31: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <31> Digital Design and Computer Architecture: ARM® Edition © 2015

11

10

2:4 Decoder

Address

Data0Data1Data2

01

00

2 Data2 = A1 ^ A0

Data1 = A1 + A0

Data0 = A1A0

ROM Logic

Page 32: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <32> Digital Design and Computer Architecture: ARM® Edition © 2015

11

10

2:4Decoder

A, B

ZYX

01

00

2

Implement the following logic functions using a 22 × 3-bit ROM:– X = AB– Y = A + B– Z = A B

Example: Logic with ROMs

Page 33: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <33> Digital Design and Computer Architecture: ARM® Edition © 2015

11

10

2:4Decoder

A, B

ZYX

01

00

2

Implement the following logic functions using a 22 × 3-bit ROM:– X = AB– Y = A + B– Z = A B

Example: Logic with ROMs

Page 34: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <34> Digital Design and Computer Architecture: ARM® Edition © 2015

wordline311

10

2:4Decoder

Address

01

00

storedbit = 0wordline2

wordline1

wordline0

storedbit = 1

storedbit = 0

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

bitline2 bitline1 bitline0

Data2 Data1 Data0

2

Data2 = A1 Å A0Data1 = A1 + A0Data0 = A1A0

Logic with Any Memory Array

Page 35: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <35> Digital Design and Computer Architecture: ARM® Edition © 2015

Implement the following logic functions using a 22 × 3-bit memory array:

– X = AB– Y = A + B– Z = A B

Logic with Memory Arrays

Page 36: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <36> Digital Design and Computer Architecture: ARM® Edition © 2015

wordline311

10

2:4Decoder

A, B

01

00

storedbit = 1wordline2

wordline1

wordline0

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 1

storedbit = 1

storedbit = 0

storedbit = 1

storedbit = 0

storedbit = 0

storedbit = 0

storedbit = 0

bitline2 bitline1 bitline0

X Y Z

2

Implement the following logic functions using a 22 × 3-bit memory array:

– X = AB– Y = A + B– Z = A B

Logic with Memory Arrays

Page 37: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <37> Digital Design and Computer Architecture: ARM® Edition © 2015

storedbit = 1

storedbit = 0

00

01

2:4Decoder

A

storedbit = 0

bitline

storedbit = 0

Y

B

10

11

4-word x 1-bit Array

A B Y0 00 11 01 1

0001

TruthTable

A1

A0

Called lookup tables (LUTs): look up output at each input combination (address)

Logic with Memory Arrays

Page 38: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <38> Digital Design and Computer Architecture: ARM® Edition © 2015

A1

A3WD3

WE3

A2

CLK

Array

RD2RD1 M

MNN

NM

• Port: address/data pair

• 3-ported memory

– 2 read ports (A1/RD1, A2/RD2)

– 1 write port (A3/WD3, WE3 enables writing)

• Register file: small multi-ported memory

Multi-ported Memories

Page 39: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <39> Digital Design and Computer Architecture: ARM® Edition © 2015

// 256 x 64 memory module with one read/write portmodule dmem(input logic clk, we,

input logic [7:0] a,input logic [63:0] wd,output logic [63:0] rd);

logic [63:0] RAM[255:0];

always @(posedge clk)begin rd <= RAM[a]; // synchronous readif (we)RAM[a] <= wd; // synchronous write

endendmodule

SystemVerilog Memory Arrays

Page 40: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <40> Digital Design and Computer Architecture: ARM® Edition © 2015

// 16 x 32 register file with two read, 1 write portmodule rf(input logic clk, we3,

input logic [3:0] a1, a2, a3,input logic [31:0] wd3,output logic [31:0] rd1, rd2);

logic [31:0] RAM[15:0];

always @(posedge clk) // synchronous writeif (we3)

RAM[a3] <= wd3;assign rd1 = RAM[a1]; // asynchronous readassign rd2 = RAM[a2];

endmodule

SystemVerilog Register File

Page 41: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <41> Digital Design and Computer Architecture: ARM® Edition © 2015

• PLAs (Programmable logic arrays)– AND array followed by OR array– Combinational logic only

– Fixed internal connections

• FPGAs (Field programmable gate arrays)– Array of Logic Elements (LEs)

– Combinational and sequential logic– Programmable internal connections

Logic Arrays

Page 42: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <42> Digital Design and Computer Architecture: ARM® Edition © 2015

X Y

A B C

AND ARRAY

OR ARRAY

ABC

AB

ABC

ANDARRAY

ORARRAY

Inputs

Outputs

ImplicantsN

M

P

• X = ABC + ABC• Y = AB

PLAs

Page 43: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <43> Digital Design and Computer Architecture: ARM® Edition © 2015

ANDARRAY

ORARRAY

Inputs

Outputs

ImplicantsN

M

P

X Y

ABC

AB

ABC

A B C

AND ARRAY

OR ARRAY

PLAs: Dot Notation

Page 44: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <44> Digital Design and Computer Architecture: ARM® Edition © 2015

• Composed of:– LEs (Logic elements): perform logic– IOEs (Input/output elements): interface with outside

world– Programmable interconnection: connect LEs and

IOEs– Some FPGAs include other building blocks such as

multipliers and RAMs

FPGA: Field Programmable Gate Array

Page 45: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <45> Digital Design and Computer Architecture: ARM® Edition © 2015

General FPGA Layout

Page 46: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <46> Digital Design and Computer Architecture: ARM® Edition © 2015

• Composed of:– LUTs (lookup tables): perform combinational logic– Flip-flops: perform sequential logic– Multiplexers: connect LUTs and flip-flops

LE: Logic Element

Page 47: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <47> Digital Design and Computer Architecture: ARM® Edition © 2015

Altera Cyclone IV LE

Page 48: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <48> Digital Design and Computer Architecture: ARM® Edition © 2015

• The Altera Cyclone IV LE has:– 1 four-input LUT – 1 registered output – 1 combinational output

Altera Cyclone IV LE

Page 49: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <49> Digital Design and Computer Architecture: ARM® Edition © 2015

Show how to configure a Cyclone IV LE to perform the following functions:

– X = ABC + ABC– Y = AB

LE Configuration Example

Page 50: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <50> Digital Design and Computer Architecture: ARM® Edition © 2015

Show how to configure a Cyclone IV LE to perform the following functions:

– X = ABC + ABC– Y = AB

LE Configuration Example

LUT output0 00 11 01 1

0100

data 20000

0 00 11 01 1

1111

0010

XXXXXXXX

data 1(A) (B) (C) (X)

data 1

0

AB0 Y

data 4data 3

data 2data 3data 4 LUT

data 1

0

ABC X

data 2data 3data 4 LUT

LUT output0101

0010

data 20011

XXXX

data 1(A) (B) (Y)

data 4data 3XXXX

LE 1

LE 2

Page 51: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <51> Digital Design and Computer Architecture: ARM® Edition © 2015

How many LEs are required to build a 5-input AND gate?

Solution: 2. First performs AND4 (function of 4 variables). Second performs AND2 of the first result and the 5th input.

LE Example: AND5

Page 52: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <52> Digital Design and Computer Architecture: ARM® Edition © 2015

How many LEs are required to build an 8-bit shift register?

Solution: 8. The shift register has 8 flip-flops, so it requires at

least 8 LEs. There is no logic between flops, so 8 LEs is

sufficient.

LE Example: 8-bit shift register

Page 53: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <53> Digital Design and Computer Architecture: ARM® Edition © 2015

How many LEs are required to build a 3-bit counter?

Solution: 3. The counter has 3 flip-flops, so it requires at least 3

LEs. The add logic for each bit is a function of less than 4

variables, so it can fit in the LUT before the flop. Hence, 3 LEs is

sufficient.

LE Example: 3-bit counter

Page 54: Lecture 10 - Harvey Mudd Collegepages.hmc.edu/harris/class/e85/lect10.pdf · Digital Design and Computer Architecture: ARM® Edition © 2015 Lecture 10  Address Data N Array

Lecture 10 <54> Digital Design and Computer Architecture: ARM® Edition © 2015

Using a CAD tool (such as Altera’s Quartus II)• Enter the design with a HDL• Simulate the design• Synthesize design and map it onto FPGA• Download the configuration onto the FPGA• Test the design

FPGA Design Flow

This is an iterative process!