6
1 03/25/22 Assalam Alaikum VLSI-2009 Gul Munir Ujjan Lecturer CISE Department, NEDUET Karachi

14/14/2015 Assalam Alaikum VLSI-2009 Gul Munir Ujjan Lecturer CISE Department, NEDUET Karachi

Embed Size (px)

Citation preview

104/18/23

Assalam AlaikumVLSI-2009

Gul Munir Ujjan

LecturerCISE Department, NEDUET

Karachi

204/18/23

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)

Solution – Q2 (Test#3 – VLSI – 2009)Original Code Optimized Code Optimization Errors (Rules Violated)

1 always@ (*) No Change Needed Students who have tried for sensitivity list:No mark deduction who have tried :right or wrong

2 begin 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

16 end//always No Change Needed

Solution – Q2 (Test#3 – VLSI – 2009)Original Code Optimized Code Optimization Errors (Rules Violated)

1 always@ (*) No Change Needed Students who have tried for sensitivity list:No mark deduction who have tried :right or wrong

2 begin 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

16 end//always No Change Needed

504/18/23

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)

604/18/23

Wish you all:

THE BEST

Solution – Q2 (Test#3 – VLSI – 2009)