This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Q5. Study the process given below and answer the questions below: process type vec is array(0 to 3) of integer; variable x:vec := (1,-2,4,2); variable y:vec := (1,-5,3,2); variable s:integer:=0; variable i:integer; variable j:integer:=0; begin assert j=0 report “calculation over” severity failure; i:=0; while i<=2 loop i:=i+1; if (x(i) > y(i)) then s = s + x(i)*y(i); else next; end if; end loop; j:=j+1; wait for 10ns; end process; (i) How many times is the loop executed? (ii)How many times is the ‘next’ statement executed? (iii)What is the value of s after the process executes? (iv)If ‘next’ is replaced by ‘exit’ what would be the answer to part (iii)? (v) Why is the ‘wait’ statement required at the end?...
View Full Document
This note was uploaded on 01/17/2012 for the course ECEC 302 taught by Professor Karkalprabhu during the Spring '06 term at Drexel.
- Spring '06