Controller Design Five step controller design process 1

  • Slides: 11
Download presentation
Controller Design • Five step controller design process 1

Controller Design • Five step controller design process 1

Controller Design: Laser Timer Example • Step 2: Create architecture – 2 -bit state

Controller Design: Laser Timer Example • Step 2: Create architecture – 2 -bit state register (for 4 states) – Input b, output x – Next state signals n 1, n 0 • Step 3: Encode the states – Any encoding with each state unique will work b x=1 01 On 1 x=1 10 On 2 x b Combinational n 1 logic n 0 s 1 s 0 clk x=1 11 On 3 outpu FSM outputs – Already done Inputs: b; Outputs: x x=0 00 b’ Off FSM inputs • Step 1: Capture the FSM State register 2

Controller Design: Laser Timer Example (cont) • Step 4: Create state table Inputs: b;

Controller Design: Laser Timer Example (cont) • Step 4: Create state table Inputs: b; Outputs: x x=0 00 b’ Off b x=1 01 On 1 x=1 10 On 2 x=1 11 On 3 3

Controller Design: Laser Timer Example (cont) • Step 5: Implement combinational logic x =

Controller Design: Laser Timer Example (cont) • Step 5: Implement combinational logic x = s 1 + s 0 (note from the table that x=1 if s 1 = 1 or s 0 = 1) n 1 = s 1’s 0 b’ + s 1’s 0 b + s 1 s 0’b’ + s 1 s 0’b n 1 = s 1’s 0 + s 1 s 0’ n 0 = s 1’s 0’b + s 1 s 0’b’ + s 1 s 0’b n 0 = s 1’s 0’b + s 1 s 0’ 4

Controller Design: Laser Timer Example (cont) • Step 5: Implement combinational logic (cont) Combinational

Controller Design: Laser Timer Example (cont) • Step 5: Implement combinational logic (cont) Combinational Logic b FSM inputs x FSM ou n 1 n 0 s 1 clk s 0 State register x = s 1 + s 0 n 1 = s 1’s 0 + s 1 s 0’ n 0 = s 1’s 0’b + s 1 s 0’ 5

Understanding the Controller’s Behavior x=0 00 Off b b’ b x=1 x=1 01 On

Understanding the Controller’s Behavior x=0 00 Off b b’ b x=1 x=1 01 On 1 10 On 2 11 On 3 b 0 0 0 0 clk s 1 0 0 x=0 00 Off s 0 0 0 state=00 x 0 00 Off b’ x=1 x=1 01 On 1 10 On 2 11 On 3 b 1 0 0 0 n 1 0 0 1 n 0 0 0 clk s 1 0 0 s 0 0 1 state=00 b x 0 b’ x=1 x=1 01 On 1 10 On 2 11 On 3 b 1 0 1 1 n 1 0 0 0 n 0 1 0 clk s 1 1 n 0 0 s 0 0 1 x 1 0 state=01 Inputs: b Outputs: x 6

Controller Example: Button Press Synchronizer bi Button press synchronizer controller bo • Want simple

Controller Example: Button Press Synchronizer bi Button press synchronizer controller bo • Want simple sequential circuit that converts button press to single cycle duration, regardless of length of time that button actually pressed – We assumed such an ideal button press signal in earlier example, like the button in the laser timer controller 7

Controller Example: bi’ A bi bo=0 B bi C bi’ bi bo=1 bo=0 bi

Controller Example: bi’ A bi bo=0 B bi C bi’ bi bo=1 bo=0 bi bo Combinational logic s 1 clk s 0 FSM outputs FSM inputs: bi; FSM outputs: bo FSM inputs Button Press Synchronizer (cont) Step 2: Create architecture n 1 n 0 n 1 = s 1’s 0 bi + s 1 s 0 bi n 0 = s 1’s 0’bi bo = s 1’s 0 bi’ + s 1’s 0 bi = s 1 s 0 State register Combinational logic Step 1: FSM bo bi n 1 FSM inputs: bi; FSM outputs: bo bi’ 00 bo=0 bi 01 bo=1 bi’ bi n 0 bi 10 bi’ s 1 bo=0 clk Step 3: Encode states Step 4: State table s 0 State register Step 5: Create combinational circuit 8 Step 5: Create combinational circuit outp FS

Controller Example: Sequence Generator • Want generate sequence 0001, 0011, 1100, 1000, (repeat) –

Controller Example: Sequence Generator • Want generate sequence 0001, 0011, 1100, 1000, (repeat) – Each value for one clock cycle – Common, e. g. , to create pattern in 4 lights, or control magnets of a “stepper motor” w x y z Inputs: none; Outputs: w, x, y, z wxyz=0001 wxyz=1000 A D Combinational logic s 1 B C wxyz=0011 wxyz=1100 Step 1: Create FSM clk s 0 Inputs: none; Outputs: w, x, y, z n 1 n 0 State register wxyz=0001 wxyz=1000 A D B 00 01 C wxyz=0011 Step 2: Create architecture Step 3: Encode states w x y z s 1 Step 4: Create state table 10 wxyz=1100 w = s 1 x = s 1 s 0’ y = s 1’s 0 z = s 1’ n 1 = s 1 xor s 0 n 0 = s 0’ clk 11 s 0 State register n 0 FSM outp n 1 Step 5: Create combinational circuit 9

Controller Example: Secure Car Key • Inputs: a; Outputs: r Step 1 Wait r=0

Controller Example: Secure Car Key • Inputs: a; Outputs: r Step 1 Wait r=0 a (from earlier example) a’ K 1 K 2 K 3 K 4 r=1 r=0 r=1 a r Combinational logic Step 2 FSM inputs n 2 n 1 outputs FSM n 0 s 2 s 1 s 0 clk State register Inputs: a; Outputs: r Step 3 r=0 000 a a’ 001 010 011 100 r=1 r=0 r=1 We’ll omit Step 5 Step 4 10

Example: Seq. Circuit to FSM (Reverse Engineering) What does this circuit do? y x

Example: Seq. Circuit to FSM (Reverse Engineering) What does this circuit do? y x y=s 1’ z = s 1 s 0’ n 1=(s 1 xor s 0)x FSM outputs n 0=(s 1’*s 0’)x states z FSM inputs states with outputs n 1 n 0 s 1 clk s 0 State register Work backwards Pick any state names you want states with outputs and transitions 11