58
SHIFT REGISTER SERIAL COMMUNICATION System Digital 1

Shift Register Serial Communication

  • Upload
    natara

  • View
    102

  • Download
    3

Embed Size (px)

DESCRIPTION

Shift Register Serial Communication. System Digital. D. D. D. D. Q. Q. Q. Q. Pokok Bahasan. Shift Registers Definisi Model I/O : Serial, Pararel dan Kombinasi Arah pergeseran : Kiri, Kanan dan dua arah Applikasi/penggunaan Implementasi VHDL MSI Shift Registers Komunikasi Serial. - PowerPoint PPT Presentation

Citation preview

Page 1: Shift Register Serial Communication

SHIFT REGISTERSERIAL COMMUNICATION

System Digital

1

Page 2: Shift Register Serial Communication

POKOK BAHASAN Shift Registers

Definisi Model I/O : Serial, Pararel dan Kombinasi Arah pergeseran : Kiri, Kanan dan dua arah Applikasi/penggunaan Implementasi VHDL

MSI Shift Registers Komunikasi Serial

2

D QInput

Clock

D Q D Q D Q

Q3 Q2 Q1 Q0

Enable

Output

Page 3: Shift Register Serial Communication

SHIFT REGISTERSMemanfaatkan register untuk penyimpanan, manipulasi dan transfer (pemindahan) data

3

Page 4: Shift Register Serial Communication

DEFINISI Register adalah sebuah rangkaian digital dengan

dua (2) fungsi utama : Data storage dan Data Movement Shift register menyediakan fungsi data movement A shift register “shifts” its output once every clock

cycle Shift register adalah sekelompok flip flop yang

dipasang secara linier dengan masukan dan keluaran saling disambungkan satu dengan yang lain, sehingga data akan digeser dari satu alat ke alat yang lain ketika rangkaian tersebut diaktifkan

4

Page 5: Shift Register Serial Communication

PEMANFAATAN SHIFT REGISTER

5

Komunikasi UART -> Universal

asynchronous receiver/transmitter

Konversi antara serial dan pararel

Penyimpanan sementara di processor scratch-pad memories

Operasi Aritmatika Perkalian, pembagian

Applikasi counter Johnson counter ring counter LSFR counters

time delay devices more …

Page 6: Shift Register Serial Communication

SHIFT REGISTER CHARACTERISTICS Tipe

Serial-in, Serial-out Serial-in, Parallel-out Parallel-in, Serial-out Parallel-in, Parallel-out Universal

Arah Left shift Right shift Rotate (right or left) Bidirectional

6

n-bit shift register

Page 7: Shift Register Serial Communication

DATA MOVEMENT Bit – bit dalam shift register dapat digeser

sesuai gambar dibawah ini

7

Page 8: Shift Register Serial Communication

n-bit shift register

n-bit shift register

DATA MOVEMENT Blok diagram shift register dengan berbagai

variasi input/output

8

n-bit shift register

n-bit shift register

Page 9: Shift Register Serial Communication

n-bit shift register

SERIAL-IN SERIAL-OUT Bit data masuk satu persatu

dan keluar satu per satu Satu flip flop bertugas

untuk menyimpan satu data Pergerakan data dapat

geser kiri / kanan, pada umumnya satu register hanya bisa satu arah.

Masukan Asynchronous preset dan clear digunakan untuk set nilai awal

9

Page 10: Shift Register Serial Communication

SERIAL-IN SERIAL-OUT Rangkaian logika ini menunjukkan gambar secara umum

Serial in Serial Out Shift Register Menggunakan SR Flip Flop Dirangkai sehingga memiliki perilaku seperti flip-flop D Nilai masukan input akan digeser ke setiap flip-flop

berpadanan dengan clock pulse

10

N-Bit Shift Register

0N 1

Page 11: Shift Register Serial Communication

SHIFT REGISTERS Shift register paling sederhana hanya menggunakan flip-flops Keluaran dari flip-flop disambungkan dengan masukan D pada flip-flop

berikutnya di sebelah kanan Setiap pulsa clock akan menggeser nilai register satu bit satu posisi ke

sebelah kanan Serial input (SI) menentukan status masukan Flipflop paling kiri pada saat

terjadinya pergeseran, Serial output (SO) diambil dari keluaran flipflop paling kanan

Perhatikan animasi

11

Q Q QQ

Page 12: Shift Register Serial Communication

SERIAL-IN SERIAL-OUT Cara paling mudah untuk

mempelajari adalah lihat ilustrasi pada sebelah kanan

4 bit data word “1011” akan di geser pada 4 bit shift register

One shift per clock pulse Data di tunjukkan masuk

dari sisi sebelah kiri dan keluar dari sisi kanan

12

1

2

3

4

5

Page 13: Shift Register Serial Communication

SERIAL-IN SERIAL-OUT Diagram di sebelah

kanan menunjukkan urutan 4 bit “1010” di load ke 4 bit SISO shift register

Setiap bit akan bergeser 1 posisi ke sebelah kanan pada setiap terjadi clock leading edge

dibutuhkan 4 pulsa clock untuk memasukkan seluruh bit ke register. 13

Page 14: Shift Register Serial Communication

SERIAL-IN SERIAL-OUT Diagram disebelah

kanan menunjukkan urutan 4 bit “1010” unloaded dari 4 bit SISO shift register

Setiap bit akan bergerak satu bit ke kanan setiap signal clock

Dibutuhkan 4 clock untuk mengakhiri proses tersebut.

14

Page 15: Shift Register Serial Communication

SERIAL-IN SERIAL-OUT SISO di pergunakan

untuk komunikasi data : RS-232 modem transmission

and reception Ethernet links SONET etc.

15

Page 16: Shift Register Serial Communication

SERIAL-IN SERIAL-OUT IN VHDL Berikut ini adalah kode program implementasi VHDL untuk 8

bit shift register pada positif edge clock Serial in Serial Out

16

library ieee;use ieee.std_logic_1164.all;

entity shift is port(C, SI : in std_logic; SO : out std_logic);end shift;

architecture archi of shift is signal tmp: std_logic_vector(7 downto 0); begin process (C) begin if (C'event and C='1') then for i in 0 to 6 loop tmp(i+1) = tmp(i); end loop; tmp(0) = SI; end if; end process; SO = tmp(7);end archi;

Page 17: Shift Register Serial Communication

KONVERSI SERIAL-TO-PARALLEL Konversi serial ke pararel

dibutuhkan pada saat Misal setelah menerima

transmisi data secara serial Ilustrasi 4 bit serial in

pararel out Shift register di gambarkan di sebelah kanan

Output Q pada flipflop paling kanan juga dapat berfungsi sebagai serial out.

17

n-bit shift register

Page 18: Shift Register Serial Communication

SERIAL-TO-PARALLEL CONVERSION Digunakan serial in

pararel out shift register sepanjang N untuk mengubah N bit word dari serial ke pararel.

Di butuhkan pulsa N clock untuk load dan 1 clock pulse untuk unload

18

Page 19: Shift Register Serial Communication

SERIAL-TO-PARALLEL CONVERSION Dua buah shift

register di sebelah kanan digunakan konversi serial data ke pararel data

Register bagian bawah akan menyediakan untuk register bagian atas, ketika di geser oleh register bag bawah

19

Page 20: Shift Register Serial Communication

PARALLEL-TO-SERIAL CONVERSION Data di applikasikan ke bentuk

pararel, kemudian di umpan masukkan ke Pin A hingga D.

Kemudian dibaca secara sequential pada register 1 bit pada satu waktu dari PA ke PD setiap 1 siklus clock dalam bentuk serial

Satu pulsa clock untuk load Empat pulsa clock untuk unload

20

n-bit shift register

Page 21: Shift Register Serial Communication

PARALLEL-TO-SERIAL CONVERSION Logic circuit for a parallel-in, serial-out shift

register

21Mux-like

0

0

1

0

1

1

Page 22: Shift Register Serial Communication

PARALLEL-IN PARALLEL-OUT Parallel-in Parallel-out Shift

Registers can serve as a temporary storage device or as a time delay device

The DATA is presented in a parallel format to the parallel input pins PA to PD and then shifted to the corresponding output pins QA to QD when the registers are clocked

One clock pulse to load One pulse to unload

22

Page 23: Shift Register Serial Communication

n-bit shift register

UNIVERSAL SHIFT REGISTER Universal shift register Can do any combination of

parallel and serial input/output operations

Requires additional inputs to specify desired function

Uses a Mux-like input gating

23

L/SL/S

A

B

A

BF

1

01

0

Page 24: Shift Register Serial Communication

UNIVERSAL SHIFT REGISTER Parallel-in, parallel-out shift register

24

Mux-like

0

0

1

0

1

1

Page 25: Shift Register Serial Communication

UNIVERSAL SHIFT REGISTER Parallel shift register (can serve as converting

parallel-in to serial-out shifter):

25

Page 26: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS164 is an 8-Bit

Serial-In Parallel-Out Shift Register

Typical Shift Frequency of 35 MHz

Asynchronous Master Reset

Gated Serial Data Input

Fully Synchronous Data Transfers

26

Page 27: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS164 8-Bit Serial-In Parallel-Out Shift

Register

27

Page 28: Shift Register Serial Communication

MSI SHIFT REGISTERS The 74LS164 is an edge-

triggered 8-bit shift register with serial data entry and an output from each of the eight stages.

Data is entered serially through one of two inputs (A or B); either of these inputs can be used

as an active HIGH Enable for data entry through the other input

an unused input must be tied HIGH, or both inputs connected together

28

Page 29: Shift Register Serial Communication

MSI SHIFT REGISTERS Each LOW-to-HIGH transition on

the Clock (CP) input shifts data one place to the right

This also enters into Q0 the logical AND of the two data inputs (A•B) that existed before the rising clock edge.

29

Page 30: Shift Register Serial Communication

MSI SHIFT REGISTERS

74LS164 logic diagram

30

A LOW level on the Master Reset (MR) input overrides all other inputs and clears the register asynchronously, forcing all Q outputs LOW.

Page 31: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS166 is an 8-Bit

Shift Register Parallel-in or serial-in

shift/load input establishes the parallel-in or serial-in mode

Serial-out Synchronous Load

Serial data flow is inhibited during parallel loading

Direct Overriding Clear

31

Page 32: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS166 is an 8-Bit Shift Register

32

Page 33: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS166 8-Bit Shift Register is a parallel-in or

serial-in, serial-out shift register

33

Page 34: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS166 is an 8-Bit Shift

Register

34

Page 35: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS166 is an 8-Bit Shift Register

35

Page 36: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS194 4-Bit

Bidirectional Universal Shift Register

may be used in serial-serial, shift left, shift right, serial-parallel, parallel-serial, and parallel-parallel

data register transfers

36

Page 37: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS194 4-Bit Bidirectional Universal Shift

Register

37

Page 38: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS194 control inputs S1 and S0

38

Page 39: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS194 4-Bit Bidirectional Universal Shift

Register

39

01 11 10 00 01 11 10 0001 11 10 0001 11 10 00

Page 40: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS194 4-Bit Bidirectional Universal Shift

Register

40

Page 41: Shift Register Serial Communication

“UNIVERSAL” SHIFT REGISTER74X194

Shift left Shift right Load Hold

41

Page 42: Shift Register Serial Communication

MSI SHIFT REGISTERS One stage of the 74x194

42

Page 43: Shift Register Serial Communication

VHDL DHIFT REGISTER Universal shift

register design

The 3-bit function select determines the operation of the register

Serial in and Parallel load available

43

library IEEE;use IEEE.std_logic_1164.all;use IEEE.std_logic_unsigned.all;

entity Vshftreg is port (CLK, CLR, RIN, LIN: in STD_LOGIC; S: in STD_LOGIC_VECTOR (2 downto 0); -- function select D: in STD_LOGIC_VECTOR (7 downto 0); -- data in Q: out STD_LOGIC_VECTOR (7 downto 0) -- data out);end Vshftreg;

architecture Vshftreg_arch of Vshftreg issignal IQ: STD_LOGIC_VECTOR (7 downto 0);beginprocess (CLK, CLR, IQ) begin if (CLR='1') then IQ <= (others=>'0'); elsif (CLK'event and CLK='1') then case CONV_INTEGER(S) is when 0 => null; -- Hold when 1 => IQ <= D; -- Load when 2 => IQ <= RIN & IQ(7 downto 1); -- Shift right when 3 => IQ <= IQ(6 downto 0) & LIN; -- Shift left when 4 => IQ <= IQ(0) & IQ(7 downto 1); -- Shift circular right when 5 => IQ <= IQ(6 downto 0) & IQ(7); -- Shift circular left when 6 => IQ <= IQ(7) & IQ(7 downto 1); -- Shift arithmetic right when 7 => IQ <= IQ(6 downto 0) & '0'; -- Shift arithmetic left when others => null; end case; end if; Q <= IQ; end process;end Vshftreg_arch;

Page 44: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS299 is an 8-bit

universal shift/storage register with 3-state outputs

Four modes of operation are possible: hold (store) shift left shift right load data

44

Page 45: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS299 universal shift/storage register

45

Page 46: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS299 universal shift/storage register

46

S0S1

D Q

CPCD

Page 47: Shift Register Serial Communication

MSI SHIFT REGISTERS 74LS299 logic circuit diagram:

The parallel load inputs and flip-flop outputs are multiplexed to reduce the total number of package pins.

Separate outputs are provided for flip-flops Q0 and Q7 to allow easy cascading.

A separate active LOW Master Reset is used to reset the register.

47

Page 48: Shift Register Serial Communication

SERIAL COMMUNICATIONSA practical application of Registers / Shift Registers48

Page 49: Shift Register Serial Communication

SERIAL DATA SYSTEMS (E.G., TPC)

Read discussion and study circuits in text. 49

Page 50: Shift Register Serial Communication

SERIAL DATA TRANSMISSION Parallel-to-serial conversion for serial

transmission

50serial transmission media

in: parallel data

out: parallel data

Destination moduleSource module

Page 51: Shift Register Serial Communication

SERIAL DATA IN THE PHONE SYSTEM (E-1) 2.048 Mb/s links between phone switches

and subscribers partitioned into 32 64 Kb/s channels

Each channel gets a timeslot in a “frame” where it can send 8 bits every 125 sec. 8000 frames/sec

51

Page 52: Shift Register Serial Communication

TIMESLOT DETAILS

52

count = 255

Page 53: Shift Register Serial Communication

PARALLEL-TO-SERIAL CONVERSION

53

256

LSBs are bit number

Assert shift-registerLOAD input during bit 7

Timeslot number canbe decoded and usedto select source ofparallel data

Serial data todestination

count = 255

Page 54: Shift Register Serial Communication

SERIAL-TO-PARALLEL CONVERSION

54

Synchronize destination’s counter to source’s

Shift in serial data

Detect that acomplete bytehas beenreceived

Holding registerfor completebyte

Note:loads0…0

Page 55: Shift Register Serial Communication

DESTINATION TIMING

55Serial-in, parallel-outshift register outputs

Holding-register outputsGrab complete byte when available

Page 56: Shift Register Serial Communication

SERIAL COMMUNICATION ON ONE WIRE Serial communication requires three signals:

CLOCK, SYNC, and DATA. Yet only one “wire” is used. How?

One solution: Manchester code.

56

• Or use a phase-locked loop (analog circuit)to extract clock from the data:

Page 57: Shift Register Serial Communication

STILL A COUPLE OF PROBLEMS Framing -- SYNC signal

Solution: Use a unique data pattern for SYNC PLL clock recovery -- what if too many zeroes

are transmitted? PLL can’t stay in sync. Solution: Use a code that guarantees a minimum

number of ones Phone system: Map 00000000 --> 00000010

(creating slight voice distortion) Gigabit Ethernet: Uses 8B10B code, solving

both problems Map each byte into 8 bits Use only a “good” subset of 210 code words Use another code word for synchronization

57

Page 58: Shift Register Serial Communication

ASSIGNMENTS Completed Part 2 Midterm problems due

Wednesday

Continue working on the MIPS project Description available on the course web page

58