1 / 15

Sequential Design

Sequential Design. Sequential code. Code written within the following statements execute sequentially. Process Functions Procedures. Process. A process is a sequential section of VHDL code. It is characterized by the presence of following statements: IF Wait Case Loop.

mort
Download Presentation

Sequential Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sequential Design

  2. Sequential code • Code written within the following statements execute sequentially. • Process • Functions • Procedures

  3. Process • A process is a sequential section of VHDL code. • It is characterized by the presence of following statements: • IF • Wait • Case • Loop

  4. Process (cont..) • A Process must be installed in the main code, and is executed every time a signal in the sensitivity list changes (or the condition related to WAIT is fulfilled). • Syntax: [label:] Process (sensitivity list) [variable name type [range] [:=initial value;]] Begin (sequential code) End Process [label];

  5. If statement If condition then assignments; elsif condition then assignments; ………………….. ……… else assignments; end if;

  6. Case statements The format of a case statement is caseexpressionis whenchoices => sequential-statements -- branch #1 whenchoices => sequential-statements -- branch #2 -- Can have any number of branches. [ when others =>sequential-statements] -- last branch end case;

  7. Case (cont.) • The case statement is very similar to when statement. • All the permutation must be tested, so the keyword OTHERS may be used. • NULL may be used, when no action is required to take place. e.g. When OTHERS => NULL;

  8. entity MUX is port (A, B, C, D: in BIT; CTRL: in BIT_VECTOR(0 to 1); Z: out BIT); end MUX; architecture MUX_BEHAVIOR of MUX is constant MUX_DELAY: TIME := 10 ns; begin PMUX: process (A, B, C, D, CTRL) variable TEMP: BIT; begin case CTRL is when "00" => TEMP := A: when"01" => TEMP := B; when"10" => TEMP := C; when "11" => TEMP := D; end case; Z <= TEMP after MUX_DELAY; end process PMUX; end MUX_BEHAVIOR;

  9. Loop • Loop is useful when a piece of code must be instantiated several times. • Loop is intended exclusively for sequential code. • For/loop : The loop is repeated a fixed number of times. [label:] FOR identifier IN range LOOP (sequential statements) END LOOP [label];

  10. Example of For/loop FACTORIAL := 1; for NUMBER in2 to N loop FACTORIAL := FACTORIAL * NUMBER; end loop; NOTE: Range must be static.

  11. Loop (cont.) • WHILE/LOOP : The loop is repeated until a condition no longer holds. [label:] WHILE condition LOOP (sequential statements); end LOOP [label];

  12. Example WHILE/Loop While (I <10) Loop wait until clk’event and clk=‘1’; (other statement) End loop;

  13. Other statements • EXIT • Used for ending the loop [label:] EXIT [label] [WHEN condition] • NEXT • Used for skipping loop steps. [label:] NEXT [loop_label] [WHEN condition]

  14. Example (exit and Next) SUM := 1; J := 0; L3: loop J:=J+21; SUM := SUM* 10; if (SUM > 100) then exit L3; -- "exit;" also would have been sufficient. end if; end loop L3;

  15. Example (next) For I in 0 to 15 loop next when I= skip; -- jump to next iteration

More Related