7 Registers

Post on 14-Apr-2018

227 views 0 download

Transcript of 7 Registers

  • 7/27/2019 7 Registers

    1/28

    Registers

    CPE 49

    RMUTI

    KOTAT

  • 7/27/2019 7 Registers

    2/28

    Shift Registers

    Capability to shift bits In one or both directions

    Why?

    Part of standard CPUinstruction set

    Cheap multiplication

    Serial communications

    Just a chain of flip-flops

  • 7/27/2019 7 Registers

    3/28

    Simple 4-Bit Shift Register

    Clocked in common

    Just serial in and serial out

    Not quite a FIFO

  • 7/27/2019 7 Registers

    4/28

    Serial In - Serial Out Shift Registers

  • 7/27/2019 7 Registers

    5/28

    Serial In - Parallel Out Shift Registers

  • 7/27/2019 7 Registers

    6/28

    Parallel In - Serial Out Shift Registers

  • 7/27/2019 7 Registers

    7/28

    Parallel In - Parallel Out Shift Registers

  • 7/27/2019 7 Registers

    8/28

    Bidirectional Shift Registers

  • 7/27/2019 7 Registers

    9/28

    Shift Register Counters

    Ring Counters

  • 7/27/2019 7 Registers

    10/28

    Shift Register Counters

    Johnson Counters

  • 7/27/2019 7 Registers

    11/28

    Applications

    To p roduce time delayThe ser ial in -ser ial ou t sh if t register can be us ed as a t ime delay

    device. The amoun t of delay can be contro l led by:

    - the num ber of stages in the register

    - the clock frequ ency

    To simpl i fy com binat ional logicThe ring counter techniq ue can be effect ively ut i l ized to implement

    sync hrono us sequent ial c i rcu i ts . A major problem in the real ization of

    sequent ial c i rcu i ts is the assignment of binary cod es to the internal

    states of the circu i t in o rder to reduce the comp lexi ty of c i rcu i ts

    required. By assig nin g one f l ip-f lop to one internal state, i t is po ssib le

    to sim pl i fy the com binat ional logic required to realize the complete

    sequent ial circuit . When the circu it is in a part icular state, the f l ip-f lop

    co rrespon din g to th at state is set to HIGH and al l oth er f lip- f lops

    remain LOW.

  • 7/27/2019 7 Registers

    12/28

    Applications

    To convert serial data to paral lel dataA com puter or m icroprocessor-based system

    commonly requi res incom ing data to be in

    paral lel form at. Bu t frequently, these systems

    must commun icate w ith external devices that

    send or receive serial data. So, serial-to -

    paral lel conversion is requ ired. As shown inthe previous sections , a serial in - paral lel ou t

    register can ach ieve this.

  • 7/27/2019 7 Registers

    13/28

    Symbol

    we could gate the clock

  • 7/27/2019 7 Registers

    14/28

    Parallel Load

    Can provide parallel outputs fromflip-flops

    And also parallel inputs

  • 7/27/2019 7 Registers

    15/28

    Schematic

  • 7/27/2019 7 Registers

    16/28

    Why is this useful?

    Basis for serial communications

    Keyboard

    Serial port Initially to connect to terminals

    Now mainly for modem

  • 7/27/2019 7 Registers

    17/28

    Bidirectional Shift Register

    Shift either way

    Now we have following possible

    inputs Parallel load

    Shift from left

    Shift from right

    Also no change

    Schematic next

  • 7/27/2019 7 Registers

    18/28

    Schematic

  • 7/27/2019 7 Registers

    19/28

    Verilog for Shift Registermodule srg_4_r_v (CLK, RESET, SI, Q,SO);

    input CLK, RESET, SI;output [3:0] Q;

    output SO;

    reg [3:0] Q;assign SO = Q[3];

    always@(posedge CLK or posedge RESET)

    begin

    if (RESET)

    Q

  • 7/27/2019 7 Registers

    20/28

    Serial Transfer

    Parallel transfer over as manywires as word (for example)

    Serial transfer over a single wire Trade time for wires

    Takes n times longer

  • 7/27/2019 7 Registers

    21/28

    Example

    Clocked 4 times

    Why do this? Maybe

    these are far apart

    Could shift

    data in

    Whats on wire at each clock?

  • 7/27/2019 7 Registers

    22/28

    Table Showing Shift

    Hopefully weve figured it out

  • 7/27/2019 7 Registers

    23/28

    Serial Addition

    Shift value in serially

    Then shift through

    adder into A. Added

    to 0 if A is empty.

    At same time, new

    value going into B

    Adds one bit at a time

    Stores carry one clock

    Initially reset all

    registers

    Register A

    accumulates

  • 7/27/2019 7 Registers

    24/28

    Hardware Comparison

    Serial vs. parallel adder

    One full adder vs. n adders

    Serial takes nunits of time, parallelonly one

  • 7/27/2019 7 Registers

    25/28

    Arbitrary Count

    One more type of counter is useful

    Count an arbitrary sequence

    Maybe you need a sequence of states

  • 7/27/2019 7 Registers

    26/28

    Circuit and State Diagram

  • 7/27/2019 7 Registers

    27/28

    Shift Registers

    N-bit register with the provision for

    shifting its stored data by a bit position

    each tick of the clock.

    Serial input specifies a new bit to

    shifted into the register.

    Serial output specifies the bits being

    shifted out of the register

  • 7/27/2019 7 Registers

    28/28

    References

    http://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.html

    http://

    www.allaboutcircuits

    .com

    /vol_4

    /index.html

    http://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.htmlhttp://www.eelab.usyd.edu.au/digital_tutorial/part2/hpage.html