Download presentation
Presentation is loading. Please wait.
Published byLeo Littleton Modified over 9 years ago
1
1ASM Algorithmic State Machines (ASM) part 1
2
ASM2 Algorithmic State Machine (ASM) Our design methodologies do not scale well to real-world problems. Take this:
3
ASM3 Algorithmic State Machine (ASM) Procedure for implementing a problem with a given piece of equipment. Define digital algorithmic solutions for hardware. Resembles a conventional flow chart but interpreted differently: – ASM described the sequence as well as the timing of events. – Adapted to specify the control sequence and data processing operations.
4
ASM4 Control and datapath A digital system can be split into two components: Datapath unit: Manipulates data according to the system requirements. Control unit: Generates the signals for sequencing the operations in the data processor. Figure 8.2 Control and datapath interaction
5
ASM5 State box Figure 8.3 ASM chart state box
6
ASM6 Decision box Figure 8.4 ASM chart decision box
7
ASM7 Conditional box
8
ASM8 ASM block One entrance path Any number of exit paths Describes the state of the systems during one clock-pulse interval. The operations within the state and the conditional boxes are executed with a common clock pulse while the system is in state S_0.
9
ASM9 ASM chart – State diagram
10
ASM10 All the following operations occur simultaneously: – A A+1 – If E == 1 then R 0 – Depending on E and F, the state is changed to S_1, S_2 or S_3. Timing
11
ASM11 Design problem Design a digital system with two flip-flops, E and F, and one 4-bit binary counter, A. The individual flip-flops of A are denoted by A4,A3,A2, and A1, with A4 holding the MSB. A start signal S initiates system operation by clearing the counter A and the flip-flop F. The counter is then incremented by 1 starting from the next clock pulse and continues to increment until the operations stop. Counter bits A3 and A4 determine the sequence of operations: – If A3 == 0, E is cleared to 0 and the count continues. – If A3 == 1, E is set to 1; then if A4 == 0, the count continues, but if A4 == 1, F is set to 1 on the next clock pulse and the system stops counting.
12
ASM12 Design a digital system with two flip-flops, E and F, and one 4-bit binary counter, A. The individual flip-flops of A are denoted by A4,A3,A2, and A1, with A4 holding the MSB. A start signal S initiates system operation by clearing the counter A and the flip-flop F. The counter is then incremented by 1 starting from the next clock pulse and continues to increment until the operations stop. Counter bits A3 and A4 determine the sequence of operations: – If A3 == 0, E is cleared to 0 and the count continues. – If A3 == 1, E is set to 1; then if A4 == 0, the count continues, but if A4 == 1, F is set to 1 on the next clock pulse and the system stops counting. ASM Chart
13
ASM13 Sequence of operations L1, L3 L2 L1L2L3
14
ASM14 Sequence of operations
15
ASM15 The datapath
16
ASM16 State diagram for control
17
ASM17 State table 10000XXX11T2 0101111X10T1 0101001X10 01010X0X10 00110XX100T0 00100XX000 T2T1T0G1G0A4A3SG1G0 Present state symbol OutputsNext state InputsPresent state
18
ASM18 State table 10000XXX11T2 0101111X10T1 0101001X10 01010X0X10 00110XX100T0 00100XX000 T2T1T0G0G1A4A3SG0G1 Present state symbol OutputsNext state InputsPresent state D G1 = T 1 A 3 A 4 D G0 = T 0 S + T 1 T 0 = G 0 ’ T 1 = G 1 ’ G 0 T 2 = G 1
19
ASM19
20
20ASM Algorithmic State Machines (ASM) part 2
21
ASM21 Binary multiplier How do we do multiplication by hand? In binary?
22
ASM22 Datapath for binary multiplier Sum only two binary numbers accumulating the partial sums in Register Q. Instead of shifting the multiplicand to the left, shift the product to the right
23
ASM23 P: the number of bits in the registers ASM for binary multiplier
24
ASM24 Initial state Register B Register ARegister QC 10111 00000100110 101 P =1 Z =0
25
ASM25 Q0 = 1; add B – first partial product Register B Register ARegister QC 10111 100110 100 P =1 Z =0 10111 00000 +------ 0 10111
26
ASM26 Shift right CAQ Register B Register ARegister QC 10111 01011110010 100 P =1 Z =0
27
ASM27 Q0=1; add B – second partial product Register B Register ARegister QC 10111 00010110011 011 P =1 Z =0 10111 01011 +------ 1 00010
28
ASM28 Shift right CAQ Register B Register ARegister QC 10111 10001011001 011 P =1 Z =0
29
ASM29 Q0=0; Shift right CAQ Register B Register ARegister QC 10111 01000101100 010 P =0=0 Z =0
30
ASM30 Q0=0; Shift right CAQ Register B Register ARegister QC 10111 00100010110 001 P =0=0 Z =0
31
ASM31 Q0=1; add B – fifth partial product Register B Register ARegister QC 10111 11011010110 000 P =1=1 Z =0 10111 00100 +------ 0 11011
32
ASM32 Shift right CAQ Register B Register ARegister QC 10111 01101101010 000 P =1=1 Z =1
33
ASM33 Trace of the binary multiplication Final product in AQ = 0110110101 10101011010 Shift right CAQ 000110110 Fifth partial product 10111 Q0=1; add B 00101011001000 Q0=0; shift right CAQ 01010110010000 Q0=0; shift right CAQ 01100100010 Shift right CAQ 011000101 Second partial product 10111 Q0=1; add B 11001010110 Shift right CAQ 100101110 First partial product 10111 Q0 = 1; add B 10110011000000 Multiplier in Q PQACInitial conditions : B=10111
34
ASM34 Control Logic Signals to be generated: – T0-T3 – L (The Load signal for Register A, that allows the loading of the output of the binary adder.
35
ASM35 Control Circuit implemented with D flip-flops + Dec
36
ASM36 Making the design of the control logic easier Z=0
37
ASM37 One FF per state T0 = T0 S’ + T3 Z T1 = T0 S T2 = T1 + T3 Z’ T3 = T2 Z=0
38
ASM38 ASM with four control inputs Operations are left blank. We are interested in the design of the control part only. Four control inputs: w, x, y, z Four states: T0-T3 needs 2 flip-flops.
39
ASM39 Using MUX’es to implement the control logic Two D flip- flops encode the state. The state is decoded into state signals T0-T3 by a decoder. The current state multiplexes the next state. Challenge: how to set the inputs of the MUX’es?
40
ASM40 Multiplexer inputs G2 y’z’1111 Y0111 y’z+y’z’ = y’ y+y’z’ = y+z’ y’z1011 yz1101 yz’0101 yzyz’+yz = y y’0001 x’1110 1x0110 w1000 w0w’0000 MUX2MUX1G1 Multiplexer inputs Input conditions Next State Present state
41
ASM41 The complete circuit
42
ASM42 Count-of-Ones The system consists of two registers R1 and R2 and a flip-flop E. The system counts the number of 1’s in the number loaded into R1 and set R2 to that number. Shift one bit from R1 into E. If E == 1 then R2++ If Z = = 1 (that is R1 == 0) then stop. R2 is initialized to all 1’s. Why?
43
ASM43 Datapath for Count-of-Ones
44
ASM44 Multiplexer inputs G2 E’1011 E E0111 11None1101 Z’0110 0 Z0010 S1000 S0S’0000 MUX2MUX1G1 Multiplexer inputs Input conditions Next State Present state
45
ASM45 Control logic for Count-of-Ones
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.