Docsity

FSM Design for Algorithm Implementation: Multi-Bit Number Multiplication, Assignments of The Avant Garde in Literature and Cinema

Toggle sidebar
bg1
CS120B – Homework #2
Given November 2, 2001. Due November 8, 2001
1. Construct a FSM that realizes the following algorithm based on the datapath below.
Input two numbers.
Output the product of the two numbers.
Selector
S10
Shifter
S
2
S
1
I
L
I
R
0
ALU
M
AB
S
1
S
0
2
3
"0"
4
5
6
19
Input
S
0
1
"0"
Bus A Bus B
Result Bus
8xm
register
file
RAA
REA REB
RAB
WA
WE
16-18
15
11
12-14
8-10
7
Output
Clk
MS1 S0ALU operstions
0 0 0 Complement A
0 0 1 AND
0 1 0 XOR
0 1 1 OR
1 0 0 Decrement A
1 0 1 Add
1 1 0 Subtract
1 1 1 Increment A
ALU operations
S2 S1 S0 Shift
operstions
0 0 0 Pass
0 0 1 Pass
0 1 0 Not used
0 1 1 Not used
1 0 0 Shift left
1 0 1 Rotate left
1 1 0 Shift right
1 1 1 Rotate right
Shift operations
pf3
pf4

Partial preview of the text

Download FSM Design for Algorithm Implementation: Multi-Bit Number Multiplication and more Assignments The Avant Garde in Literature and Cinema in PDF only on Docsity!

CS120B – Homework

Given November 2, 2001. Due November 8, 2001

  1. Construct a FSM that realizes the following algorithm based on the datapath below.

Input two numbers. Output the product of the two numbers.

S (^) Selector 1 0

Shifter

S 2 S 1

IL IR

0

M ALU

A B S 1 S 0

2

3

"0"

4

5

6

19

Input

1 S 0

"0"

Bus A Bus B

Result Bus

8xm register RAA file REA REB

RAB

WA WE

16- 15

11

12- 8- 7

Output

Clk

M S 1 S 0 ALU operstions 0 0 0 Complement A 0 0 1 AND 0 1 0 XOR 0 1 1 OR 1 0 0 Decrement A 1 0 1 Add 1 1 0 Subtract 1 1 1 Increment A ALU operations

S 2 S 1 S 0 Shift operstions 0 0 0 Pass 0 0 1 Pass 0 1 0 Not used 0 1 1 Not used 1 0 0 Shift left 1 0 1 Rotate left 1 1 0 Shift right 1 1 1 Rotate right Shift operations

Answer

Algorithm 1 sum = 0 2 input x 3 input y while y <> 0 4 sum = sum + x 5 y = y - 1 6 output sum

Control words

19 18-15 14-11 10-7 6-4 3-1 0 Control words IE^ Write^

Read A

Read B

ALU operation

Shifter operation OE^ Comment 1 0 010 1 000 1 000 1 010 000 0 x xor x = 0 2 1 001 1 ××× 0 ××× (^0) ××× ××× 0 input x 3 1 000 1 (^) ××× 0 ××× 0 ××× ××× 0 input y 4 0 010 1 010 1 001 1 101 000 0 sum+= x 5 0 000 1 000 1 ××× × 100 000 0 decrement A (^6 0) ××× 0 010 1 010 1 001 000 1 sum and sum <=> pass

State diagram

S 0

S 1

S 2

S 3

S 4

S 5

S 6

input x

input y

sum = 0

start = 0

start = 1

y = 0

y <> 0 sum = sum + x

y = y - 1

output sum

y = 0

y <> 0

WE( Q 2 , Q 1 , Q 0 ) = Σ(1,2,3,4,5)

RAA 2 = 0

RAA 1 = Q 2 Q 1 'Q 0 '

RAA 0 = 0

RAE( Q 2 , Q 1 , Q 0 ) = Σ(1,4,5,6)

etc…

FSM Schematic

Clk

D 0

Q' 0

Q 0

Clk

D 1

Q' 1

Q 1

Clk

D 2

Q' 2

Q 2

Start

Clk

( y <>0)

IE

etc.