sequencing and control

40
Sequencing and Control Mano and Kime Sections 8-1 – 8-7

Upload: bona

Post on 05-Jan-2016

27 views

Category:

Documents


0 download

DESCRIPTION

Sequencing and Control. Mano and Kime Sections 8-1 – 8-7. Sequencing and Control. Algorithmic State Machines Binary Multiplier Hardwired Control Binary Multiplier – VHDL Microprogrammed Control. Algorithmic State Machine. ASM Block. Timing. Sequencing and Control. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Sequencing and Control

Sequencing and Control

Mano and Kime

Sections 8-1 – 8-7

Page 2: Sequencing and Control

Sequencing and Control

• Algorithmic State Machines

• Binary Multiplier

• Hardwired Control

• Binary Multiplier – VHDL

• Microprogrammed Control

Page 3: Sequencing and Control

Algorithmic State Machine

Page 4: Sequencing and Control

ASM Block

Timing

Page 5: Sequencing and Control

Sequencing and Control

• Algorithmic State Machines

• Binary Multiplier

• Hardwired Control

• Binary Multiplier – VHDL

• Microprogrammed Control

Page 6: Sequencing and Control

An Algorithmic Binary Multiplier

Either adding the multiplier or 0000

Page 7: Sequencing and Control
Page 8: Sequencing and Control

Shifting partial product rightis the same as shifting the multiplier to the left

Page 9: Sequencing and Control
Page 10: Sequencing and Control

Initialize the multiplier

If GO Then

Page 11: Sequencing and Control

Begin in state MUL0

Page 12: Sequencing and Control

If the right-most bit of the multiplierin the Q shift register is 0 thengoto state MUL1

Page 13: Sequencing and Control

Otherwise, if the right-most bitof the multiplier is 1 thenadd the partial product (A)to the multiplicand (B) and storeit in A. Prepare to shift in C.

Page 14: Sequencing and Control

Shift a 0 into C, shift right C || A || Q into C || A || QDecrement P

C || A || Q denotes a composite register.

Page 15: Sequencing and Control

If Z = 1 then we have gonethrough the state machinen -1 times and we are finished

Page 16: Sequencing and Control

Otherwise, if Z = 0 we continueback to state MUL0.

Page 17: Sequencing and Control

Register A contains the fourmost significant bits of theproduct and Register Q containsthe four least significant bits of the product when we are finished.

Note that n-bits x n-bits <= 2n bits

Page 18: Sequencing and Control

Sequencing and Control

• Algorithmic State Machines

• Binary Multiplier

• Hardwired Control

• Binary Multiplier – VHDL

• Microprogrammed Control

Page 19: Sequencing and Control

Let’s take a closer look at thecontrol unit

Page 20: Sequencing and Control
Page 21: Sequencing and Control
Page 22: Sequencing and Control

Sequencing State Machine

Page 23: Sequencing and Control

Decoder outputs based off ofthe present state

--The decoder plays role incontrolling the next state

Page 24: Sequencing and Control

000110

Page 25: Sequencing and Control

ASM chart transformationrules with one flip-flopper state

Notice two flip flops for the two states, MUL0 andMUL1

Page 26: Sequencing and Control
Page 27: Sequencing and Control

Decision Box

Idle Junction(from Z and G)

Idle State

junction

State MUL0

State MUL1

Z Decision Box

Page 28: Sequencing and Control

Sequencing and Control

• Algorithmic State Machines

• Binary Multiplier

• Hardwired Control

• Binary Multiplier – VHDL

• Microprogrammed Control

Page 29: Sequencing and Control

VHDL

-- Binary Multiplier with n=4; VHDL Descriptionlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;

entity binary_multiplier is port(CLK, RESET, G, LOADB, LOADQ: in std_logic; MULT_IN: in std_logic_vector(3 downto 0); MULT_OUT: out std_logic_vector(7 downto 0));end binary_multiplier;

Page 30: Sequencing and Control

architecture behavior_4 of binary_multiplier is type state_type is (IDLE, MUL0, MUL1); signal state, next_state : state_type; signal A, B, Q: std_logic_vector(3 downto 0); signal P : std_logic_vector(1 downto 0); signal C, Z: std_logic;

begin Z <= (P1) NOR P(0); MULT_OUT <= A & Q; state_register: process (CLK, RESET) begin if (RESET = ‘1’) then

state <= IDLE; elsif (CLK’event and CLK = ‘1’) then

state <= next_state; end if; end process;

State Machine

Page 31: Sequencing and Control

next_state_func: process (G, Z, state)begin case state is when IDLE =>

if G = ‘1’ then next_state <= MUL0; else next_state <= IDLE; end if;

when MUL0 => next_state <= MUL1;

when MUL1 => if Z = ‘1’ then next_state <= IDLE; else next_state <= MUL0; end if;

end case;end process;

Next State

Page 32: Sequencing and Control

datapath_func: process (CLK)variable CA: std_logic_vector(4 downto 0);begin if (CLK’event and CLK = ‘1’) then if LOADB = ‘1’ then

B <= MULT_IN; end if; if LOADQ = ‘1’ then

Q <= MULT_IN; end if; case state is when IDLE =>

if G = ‘1’ then C <= ‘0’; A <= “0000”; P <= “11”;end if;

when MUL0 =>if Q(0) = ‘1’ then CA := (‘0’ & A) + (‘0’ & B);else CA := C & A;end if;C <= CA(4);A <= CA(3 downto 0);

when MUL1 => C <= ‘0’; A <= C & A(3 downto 1); Q <= A(0) & Q(3 downto 1); P <= P - “01”;

end case; end if; end process;end behavior_4;

DATAPATH

Page 33: Sequencing and Control

Sequencing and Control

• Algorithmic State Machines

• Binary Multiplier

• Hardwired Control

• Binary Multiplier – VHDL

• Microprogrammed Control

Page 34: Sequencing and Control

In general…

Microprogrammed Control UnitOrganization

Acts like a control outputlookup table

Addresses lookup table

Page 35: Sequencing and Control

ASM Chart for microprogrammed Control Unit

Basic ASM Chart from initialdesign

Note 5 states

Page 36: Sequencing and Control

What do we store in our lookup ROM?

A Micro-instruction Control Word

Next state (1 or 5)

Page 37: Sequencing and Control

Control Signals

With this in mind, we need to design the controlwords...

Page 38: Sequencing and Control

Use two next_addresses

Page 39: Sequencing and Control

Microprogrammed Control Unit for Multiplier

Page 40: Sequencing and Control