26

Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis

# Optimizing the FSMD (cont.)

int x, y;

2:

go_i

!go_i

x = x_i

y = y_i

x<y

x>y

y = y -x

x = x - y

3:

5:

7:

8:

d_o = x

9:

y = y -x

7:

x = x - y

8:

6-J:

x!=y

5:

!(x!=y)

x<y

!(x<y)

6:

5-J:

1:

1

!1

x = x_i

y = y_i

4:

2:

2-J:

!go_i

!(!go_i)

d_o = x

1-J:

9:

int x, y;

3:

original FSMD

optimized FSMD

eliminate state 1 – transitions have constant values

merge state 2 and state 2J – no loop operation in between them

merge state 3 and state 4 – assignment operations are independent of one another

merge state 5 and state 6 – transitions from state 6 can be done in state 5

eliminate state 5J and 6J – transitions from each state can be done from state 7 and state 8, respectively

eliminate state 1-J – transition from state 1-J can be done directly from state 9