Download presentation
Presentation is loading. Please wait.
Published byJaiden Lusty Modified over 10 years ago
1
14/14/2015 Assalam Alaikum VLSI-2009 Gul Munir Ujjan Lecturer CISE Department, NEDUET Karachi
2
24/14/2015 Due to Shortage of time, I am providing the solution of Q#2, and that also, only the optimized code, with Rules violated and without effects or reasons. 2 Solution – Q2 (Test#3 – VLSI – 2009)
3
Original CodeOptimized CodeOptimization Errors (Rules Violated) 1always@ (*) No Change Needed Students who have tried for sensitivity list: No mark deduction who have tried :right or wrong 2begin No Change Needed 3 A< = 1’b1; No Change Needed 4 C< = 1’b1; No Change Needed 5 D< = 1’b0; No Change Needed 6 B< = C + D; B < = 1’b1; Constant Folding + Common sub expression 7 if (~A) Dead Code elimination (A will never be = 0 ) 8 Y< = B + C + D; Dead Code elimination 9 else Dead Code elimination 10 Y< = E + C + D; Y < = E + 1’b1; Constant Folding + Common sub expression 11 case ({ B, C }) Dead Code elimination (Reason : See Last Slide) 12 2’b 00: Y< = {D, E}; Dead Code elimination 13 2’b 01: Y< = 2’b11; Dead Code elimination 14 2’b 11: Y< = C + D; Y < = 1’b1; Constant Folding + Common sub expression 15 endcase Dead Code elimination 16end//always No Change Needed
4
Solution – Q2 (Test#3 – VLSI – 2009) Original CodeOptimized CodeOptimization Errors (Rules Violated) 1always@ (*) No Change Needed Students who have tried for sensitivity list: No mark deduction who have tried :right or wrong 2begin No Change Needed 3 X< = 1’b0; No Change Needed 4 Y< = 1’b0; No Change Needed 5 Z< = 1’b1; No Change Needed 6 W< = Y + Z; W < = 1’b1; Constant Folding + Common sub expression 7 if (~X) Dead Code elimination 8 Q< = W + Y + Z; Q < = 2’b10; Constant Folding + Common sub expression 9 else Dead Code elimination (X will never be = 1 ) 10 Q< = Y + Z; Dead Code elimination 11 case ({ Y, Z }) Dead Code elimination (Reason : See Last Slide) 12 2’b 00: Q< = 2’b10; Dead Code elimination 13 2’b 01: Q< = Y + Z; Q < = 1’b1; Constant Folding + Common sub expression 14 2’b 11: Q< = { Y, Z}; Dead Code elimination 15 endcase Dead Code elimination 16end//always No Change Needed
5
54/14/2015 For Case Structure Because the signals (Variables) in the case condition are both defined as constants so: For Test Paper with ABC constants Case ({B,C}) = case 11 will always select case arm 2’b11 For Test Paper with XYZ constants Case ({Y,Z}) = case 01 will always select case arm 2’b01 Due to always one case arm selection, the other case arms will be considered as dead code, and because it will always be one condition as true, so there is no need to test it – NO NEED OF CASE Solution – Q2 (Test#3 – VLSI – 2009)
6
64/14/2015 Wish you all: THE BEST Solution – Q2 (Test#3 – VLSI – 2009)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.