Prof. Dr. M. Schubert VHDL Practical Training FH Regensburg. VHDL distinguishes three possibilities of writing source code:

Size: px
Start display at page:

Download "Prof. Dr. M. Schubert VHDL Practical Training FH Regensburg. VHDL distinguishes three possibilities of writing source code:"

Transcription

1 3 Modeling VHDL distinguishes three possibilities of writing source code: 1. structural: instantiation of components, 2. concurrent: the sequence of source lines does not matter, no variables, 3. sequential: top-down processing of source lines, no signal declarations. This three options may be mixed, i.e. concurrent signal assignment statements, entity instantiations and processes or subprogram calls can be used together in the same architecture. The ASSERT statement is used to write messages, typically on the screen. It can be used in concurrent environment (concurrent assertion) and sequential environment (sequential assertion). BNF: assertion_statement ::= [ label : ] assertion ; Syntax: ASSERT condition [REPORT string] [SEVERITY severity_level]; The ASSERT statement writes the message given on string (default is "assertion violation") if the condition evaluates a Boolean false, otherwise it does nothing. The severity level must be one of: NOTE, WARNING, ERROR, FAILURE; default is ERROR. The compiler itself prints assertions and using additionally the severity level FATAL. ENTITY tst_assert IS END tst_assert; ARCHITECTURE arc_assert OF tst_assert IS ASSERT false REPORT "assert note" SEVERITY NOTE; ASSERT false REPORT "assert warning" SEVERITY WARNING; ASSERT false REPORT "assert error" SEVERITY ERROR; ASSERT false REPORT "assert failure" SEVERITY FAILURE; END arc_assert; Some simulators (e.g. V-System, ModelSim) offer the possibility to set an option which severity of assertion will cause the simulator to stop at that point. The user can investigate the matter in the debugger. Exercise 3: a) Compile and load the ENTITY tst_assert and run it for 10 ns. Observe the transcript window. What messages do you get? b) If the simulator stops due to an assertion, press RUN again. c) Simulators can be adjusted to stop at a specific assertions level. Load and run the ENTITY tst_assert again. Try out if your simulator has a debugger window where the source code under consideration can be viewed. - Modeling 3.1 -

2 3.1 Structural Modeling Entitys Structural modeling is based on ENTITY Instantiation. This chapter presumes the knowledge of chapter 1. A complete description of the ENTITY statement is beyond the scope of this work. Example for an entity declaration: LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY HalfAdder IS PORT( a,b: IN std_ulogic:='0'; s,c: OUT std_ulogic ); END HalfAdder; Input signals may have defaults. In the example above the signals a and b will default to '0' instead of 'U'. Example for component declaration in the declaration region of an architecture: COMPONENT HalfAdder IS PORT( a,b: IN std_ulogic:='0'; s,c: OUT std_ulogic ); END COMPONENT; Example for an entity instantiation with positional signal association: i_positional:halfadder PORT MAP(a0,b0,s0,c0); Two examples for entity instantiations with named signal association: i_named_1:halfadder PORT MAP(c=>c0,s=>s0,a=>a0,b=>b0); i_named_2:halfadder PORT MAP( c => c0, s => s0, a => a0, b => b0 ); - Modeling 3.2 -

3 3.1.2 PORT Modes Declarations in PORT statements are implicit signals declarations. This is because variables must not appear in PORTs and constants are realized by generics as detailed below. Signals in PORTs have one of the following modes: IN, OUT, INOUT, BUFFER. Mode IN OUT INOUT BUFFER functionality of PORT signal: read only write only, signal not readable inside the architecture read and write like INOUT, but the signal may have only one driver, the effect is like mode OUT but the signal may be read The OPEN keyword The keyword OPEN models a port signal with no connection to the outer world. Example for a HalfAdder with unconnected input signal a: i_unconnected_a: HalfAdder PORT MAP(c=>OPEN,s=>s0,a=>a0,b=>b0); In the example above, the default value is used for signal a as it is not connected. Missing trailing signals in positional association are handled as implicit OPEN. In the following example the trailing carry output signal is missing and therefore modeled as OPEN. i_ unconnected_c:halfadder PORT MAP(a0,b0,s0); Generics ENTITYs may have GENERICs. As a GENERIC is a constant in the interface of an ENTITY, it needs initialization. It cannot be modified during run time. Example for an entity declaration with GENERICs: LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY HalfAdder IS GENERIC(delay_and,delay_xor:TIME:=2 ns); <<<=== PORT( a,b: IN std_logic:='0'; s,c: OUT std_logic ); END HalfAdder; Input signals may have defaults. In the example above the signals a and b will default to '0' instead of 'U'. - Modeling 3.3 -

4 Example for component declaration in the declaration region of an architecture: COMPONENT HalfAdder GENERIC(delay_and,delay_xor:TIME:=2 ns); <<<=== PORT( a,b: IN std_logic:='0'; s,c: OUT std_logic ); END COMPONENT; Example for an entity instantiation with generics: CONSTANT delay_xor:time:=3 ns; delay of an XOR gate i_generic:halfadder GENERIC MAP(2 ns,delay_xor) PORT MAP(a,b,s,c); - Modeling 3.4 -

5 3.2 Concurrent Modeling A digital circuit is by its nature concurrent because all signals in the circuit have a voltage level any time. The use of entities is a means of structuring and partitioning. Sequential code is a normal, sequential programming language to internally describe external concurrent behavior Concurrent signal assignment Inertial signal assignment schedules a maximum of one event. Pulses with a width less than the delay will be cancelled: S_inertial <= a XOR b AFTER 2 ns; Transport signal assignment schedules an arbitrary number of events: S_transport <= TRANSPORT a XOR b AFTER 10 ns; Zero-delay signal assignment schedules an event with one simulation delta ( ) delay: S_deltadelay <= a XOR b; Conditional signal assignment: SIGNAL condition,a,b,y :std_logic; y <= a AFTER 1 ns WHEN condition='0' ELSE b AFTER 1 ns WHEN condition='1' ELSE 'X' AFTER 1 ns; This construct contains priority coding selecting the 1 st matching condition. It models a multiplexer that consists of nested 2-input multiplexers. The compiler will generate an error when not all possible cases are satisfied. This is because a driver (<=) cannot interrupt driving Selected signal assignment: SIGNAL sel,a,b,y :std_logic ; WITH sel SELECT y <= a AFTER 1 ns WHEN '0', b AFTER 1 ns WHEN '1', 'X' AFTER 1 ns WHEN OTHERS; This construct models a multiplexer with equivalent inputs. The compiler will generate an error when not all possible cases are satisfied. This is because a driver (<=) cannot interrupt driving. - Modeling 3.5 -

6 3.2.4 GENERATE Statement The GENERATE statement is a concurrent loop construct. BNF: generate_statement ::= generate_label : generation_scheme GENERATE [ { block_declarative_item } ] { concurrent_statement } END GENERATE [ generate_label ] ; Syntax with FOR loop: generate_label: FOR variable_name IN discrete_range GENERATE concurrent assignment... END GENERATE [generate_label]; Complete code example: LIBRARY ieee; USE ieee.std_logic_1164.all,work.pk_adder.all; ENTITY tst_generate IS END tst_generate; ARCHITECTURE arc_adder8bit OF tst_generate IS SIGNAL a,b,s: std_ulogic_vector(7 DOWNTO 0):= (OTHERS=>'0'); SIGNAL c: std_ulogic_vector(8 DOWNTO 0):=(OTHERS=>'0'); adder declaration PROCEDURE p_fulladder (cin,a,b: in std_ulogic, s,cout: out std_ulogic) IS s<= a XOR b XOR cin; cout<= (a AND b) OR (a AND cin) OR (b AND cin); END p_fulladder stimuli c(0)<='0', '1' AFTER 20 ns; a<=" ", " " AFTER 60 ns; b<=" ", " " AFTER 60 ns; 8 bit adder gen_add8bit: FOR i IN 7 DOWNTO 0 GENERATE i_add1bit: p_fulladder(c(i),a(i),b(i),s(i),c(i+1)); END GENERATE gen_add8bit; END arc_adder8bit; - Modeling 3.6 -

7 GENERATE statements can be nested and may have IF conditions. The ENTITY tst_generate2 with ARCHITECTURE arc_adder8bit2 gives an example using IF conditions to separately treat the first and last carry flag. Syntax of a conditional GENERATE statement: generate_label: IF condition GENERATE concurrent assignment... END GENERATE [generate_label]; Complete code example using nested GENERATE statements with condition: LIBRARY ieee; USE ieee.std_logic_1164.all,work.pk_adder.all; ENTITY tst_generate2 IS END tst_generate2; ARCHITECTURE arc_adder8bit2 OF tst_generate2 IS CONSTANT c_nbit: INTEGER:=8; SIGNAL cin0,cout8: std_ulogic:='0'; SIGNAL c,a,b,s,g,p: std_ulogic_vector(c_nbit-1 DOWNTO 0):=(OTHERS=>'0'); stimuli cin0<='0', '1' AFTER 20 ns; a<=" ", " " AFTER 60 ns; b<=" ", " " AFTER 60 ns; 8-bit adder gen_adder: FOR i IN 0 TO c_nbit-1 GENERATE lsb: IF i=0 GENERATE add1: p_fulladder(cin0,a(0),b(0),s(0),c(1),g(0),p(0)); END GENERATE lsb; mid: IF i>0 AND i<c_nbit-1 GENERATE addi: p_fulladder(c(i),a(i),b(i),s(i),c(i+1),g(i),p(i)); END GENERATE mid; msb: IF i=c_nbit-1 GENERATE addn: p_fulladder(c(i),a(i),b(i),s(i),cout8,g(i),p(i)); END GENERATE msb; END GENERATE gen_adder; END arc_adder8bit2; The concurrent assertion prints to the screen at time zero if the condition expression evaluates a Boolean false or in the moment when the condition expression changes from Boolean true to false. - Modeling 3.7 -

8 3.2.5 BLOCK Statement BNF: block_statement ::= block label : BLOCK [ ( guard_expression ) ] [ IS ] block_header block_declarative_part block_statement_part END BLOCK [ block_label ] ; The BLOCK statement is used in the following way: block_label: BLOCK [(guard_expression)] concurrent declarations concurrent code END BLOCK [block_label]; A BLOCK is concurrent. BLOCKs allow for design partitioning and local signal declarations. External signals and constants are visible inside the block. BLOCK statements may have a guard expression. The guarded assignment signal_g <= GUARDED wave_form; can be translated into the equivalent sequential code IF guard_expression THEN signal_g <= wave_form; END IF; where guard_expression has to deliver a Boolean result. The following source code comprehends three exercises to demonstrate the capability of BLOCK statements. The BLOCK named b_stimuli delivers the stimuli for the next two blocks. The stimuli are declared outside of the all BLOCK statements, so they are visible inside and outside of them. The BLOCK named b_4bitcounter contains the model of a 4-bit synchronous counter consisting of two subblocks: one BLOCK and one PROCESS statement. The BLOCK named b_logic contains the combinational logic, the PROCESS labeled ps_memory models the memory. - Modeling 3.8 -

9 LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY tst_block IS END tst_block; ARCHITECTURE arc_block OF tst_block IS SIGNAL reset,clk: std_ulogic:='0'; SIGNAL State,NextState: std_ulogic_vector(3 DOWNTO 0); SIGNAL Latch1,Latch2: std_ulogic_vector(3 DOWNTO 0); b_stimuli:block stimuli reset<='0', '1' AFTER 8 ns, '0' AFTER 12 ns; clk<=not clk AFTER 10 ns; END BLOCK b_stimuli; b_4bitcounter:block *** 4-bit counter *** b_nextstate_logic: BLOCK combinational logic ALIAS s: std_ulogic_vector(3 DOWNTO 0) IS State; SIGNAL nx: std_ulogic_vector(3 DOWNTO 0); CONSTANT delay:time:= 2 ns; nx(0)<=not s(0); nx(1)<=not s(1) WHEN s(0)='1' ELSE s(1); nx(2)<=not s(2) WHEN s(0)='1' AND s(1)='1' ELSE s(2); nx(3)<=not s(3) WHEN s(0)='1' AND s(1)='1' AND s(2)='1' ELSE s(3); NextState<=nx AFTER delay; END BLOCK b_nextstate_logic; memory (sequential logic) ps_memory: PROCESS(reset,clk) IF reset='1' THEN State<="0000" AFTER 1 ns; ELSIF clk'event AND clk='1' THEN State<=NextState AFTER 1 ns; END IF; END PROCESS ps_memory; END BLOCK b_4bitcounter; b_test_guarded: BLOCK *** test guarded block *** b_guard:block (clk='0') guarded block Latch1<=GUARDED NextState; END BLOCK b_guard; process equivalent to guarded block ps_guard:process(...) - Check sensitivity List! IF clk='0' THEN Latch2<=NextState; END IF; END PROCESS ps_guard; END BLOCK b_test_guarded; END arc_block; The BLOCK b_test_guarded contains the BLOCK b_guard and the PROCESS ps_guard. The goal is to design the PROCESS ps_guard such that it has exactly the same behavior as the BLOCK b_test_guarded (see exercises below). This requires some minor modifications to the code above. - Modeling 3.9 -

10 Exercise : We will now investigate the BLOCK labeled b_4bitcounter. a) Run ENTITY tst_block with the ARCHITECTURE arc_block until 400 ns. Does the state vector represented by the signal State work correctly as a 4-bit counter? b) Which three declarations are made in the declaration region of BLOCK b_logic? c) Are this three local declarations visible outside of BLOCK b_logic? d) The delay of the NextState vector evaluated in response to a change of the State vector increases from 2 ns to 12 ns at time point 50 ns. Has this change in delay impact on the assignment intervals of the State vector? Give reasons: Why or why not? e) Important for the next exercise: What is the value of clk when the signal change of NextState occurs below simulation time = 50 ns? f) Important for the next exercise: What is the value of clk when the signal change of NextState occurs above simulation time = 50 ns? Exercise : We will now investigate the BLOCK labeled b_test_guarded. a) Observe the assignment of NextState to the signal Latch1 in the guarded BLOCK named b_guard. What is the boolean condition to enable for the assignment of Latch1? b) Does this guarded assignment correspond to a state controlled latch or to an edge triggered FilpFlop? c) The BLOCK labeled b_guard is followed by a PROCESS labeled ps_guard. Change the sensitivity list of this process such, that the signals Latch1 and Latch2 behave identical with a minimum number of signals in the sensitivity list. (The actual signal reset in the sensitivity list is just a dummy.) Blocks can be useful to synthesize TriState buffers. For more detailed information about this topic the reader is referred to the literature. - Modeling

11 3.3 Sequential Modeling Sequential Statements VHDL code is sequential within PROCESSes and subprograms. Subprograms are FUNCTIONs and PROCEDUREs. Sequential code is processed top down line by line. Six sequential statements are available: ASSERT CASE IF LOOP NULL WAIT The sequential assertion prints to the screen if the program pointer processes the ASSERT statement and the condition expression evaluates a Boolean false. The CASE statement is similar to the IF statement on the first glance. However, it is easier to synthesize, because the IF statement has a new condition in any ELSIF branch, while the CASE statement takes all decisions on the base of one condition. It corresponds to a multiplexer with inputs of equivalent importance. BNF: case_statement ::= [ case_label : ] CASE expression IS case_statement_alternative { case_statement_alternative } END CASE [ case_label ] ; Syntax: l_label: CASE expression IS WHEN choices => sequential_code [WHEN choices => sequential_code] [WHEN OTHERS => sequential_code] END CASE l_label; After the WHEN keyword there may be several choices separated by a vertical bar, which symbolizes a logical OR. Example: WHEN choice1 choice2 choic3 choice4 => sequential_code Because all possible choices must be covered, the OTHERS keyword is helpful. - Modeling

12 Exercise: a) Compile, load and run the ENTITY tst_case for 150 ns. b) Are the operations AND, OR, XOR, ADD processed correctly? c) Observe the signal y at time point 30 ns. Why do all bits change to '0'? Complete code example of a little ALU: LIBRARY ieee; USE ieee.std_logic_1164.all,ieee.std_logic_unsigned."+"; ENTITY tst_case IS END tst_case; ARCHITECTURE arc_case OF tst_case IS TYPE t_instruction IS(inst_and,inst_or,inst_xor,inst_add); SIGNAL instruction: t_instruction; SIGNAL cin,cout: std_ulogic:='0'; SIGNAL a,b,y: std_ulogic_vector(7 DOWNTO 0):=(OTHERS=>'0'); stimuli cin<='0', '1' AFTER 30 ns; a<=" ", " " AFTER 60 ns; b<=" ", " " AFTER 60 ns; instruction<=inst_and, inst_or AFTER 60 ns, inst_xor AFTER 90 ns, inst_add AFTER 120 ns; ALU ps_alu: PROCESS(a,b,cin,instruction) CASE instruction IS WHEN inst_and => y<=a AND b; WHEN inst_or => y<=a OR b; WHEN inst_xor => y<=a XOR b; WHEN inst_add => y<=a + b; WHEN OTHERS => ASSERT false REPORT "unknown instruction" SEVERITY ERROR; END CASE; END PROCESS ps_alu; END arc_case; - Modeling

13 (a) (b) in0 in1 in2 in3 in4 in5 in6 in7 condition y_case in0 in1 in2 in3 in4 in5 in6 in7 y_if condition 1 condition 2 condition 3 condition 4 condition 5 condition 6 condition 7 Figure 3.3.1: Conditional assignments in sequential code using (a) CASE and (b) IF. The IF statement has built-in priority coding. BNF: if_statement ::= [ if_label : ] IF condition THEN sequence_of_statements { ELSIF condition THEN sequence_of_statements } [ ELSE sequence_of_statements ] END IF [ if_label ] ; Syntax: IF condition THEN... [ELSIF condition THEN...] [ELSE...] END IF; The whole IF statement is one statement. It may have an arbitrary number of ELSIF branches. One or no branch of the IF statement is processed. Processed is the first branch whose condition evaluates a Boolean true. Therefore, the sequence of branches implies a priority if several conditions are true at a time. An IF statement corresponds to a tree of 2-input multiplexers. NULL is a statement that does explicitly nothing. The PROCESS will run through for any event in the sensitivity list, also for negative edges on reset or clk. To demonstrate that a specific case was not forgotten NULL can explicitly state that nothing should be done here. null_statement ::= [ label : ] NULL ; - Modeling

14 Complete code example for IF and NULL: ENTITY tst_if_null IS END tst_if_null; ARCHITECTURE arc_toggle_flipflop OF tst_if_null IS SIGNAL reset,clk,q,d: BIT; stimuli reset<='0', '1' AFTER 50 ns, '0' AFTER 70 ns; clk<=not clk AFTER 20 ns; d<=not q AFTER 2 ns; d-flipflop ps_dff: PROCESS(reset,clk) IF clk'event AND clk='1' THEN q<=d AFTER 2 ns; ELSIF reset='0' THEN q<='0' AFTER 2 ns; ELSE NULL; END IF; END PROCESS ps_dff; d dff clk reset q END arc_toggle_flipflop; Toggle Flip-Flop (TFF) Exercise: a) Compile, load and run the ENTITY tst_if_null for 100 ns. b) Observe specifically the time ns: Can the FlipFlop be set during reset='1'? c) Explain the behavior of signal q observed between ns. d) What must be done to give the highest priority to the reset signal? Try it! Loops are possible in sequential code. BNF: loop_statement ::= [ loop_label : ] [ iteration_scheme ] LOOP sequence_of_statements END LOOP [ loop_label ] ; Syntax: [loop_label:] [iteration_scheme] LOOP END LOOP [loop_label]; - Modeling

15 The easiest way to produce an endless loop is the statement LOOP END LOOP; If a loop label is used before the LOOP keyword, it must e repeated after END LOOP. There are two possible iteration schemes: (1) FOR index IN discrete_range and (2) WHILE condition. Examples: FOR i IN 0 TO 15 LOOP... FOR i IN 7 DOWNTO 0 LOOP... FOR i IN DataBus'RANGE LOOP... WHILE I>=0 AND i<c_databuswidth LOOP... The range index of the FOR loop is implicitly declared by the LOOP statement and must not be assigned or modified inside the loop. A data object with same name as the loop index (e.g. a signal named i) is masked by the loop index and is not visible inside the loop. LOOP statements can be nested. In this case the inner loop must be completely inside the outer loop. There are two more statements available inside a LOOP: NEXT; EXIT [loop_label] [WHEN condition]; NEXT causes a jump to the next END LOOP without exiting the loop. EXIT causes the program to halt and to resume execution after the next END LOOP. The phrase EXIT loop_label causes the program to continue execution after END LOOP loop_label. An EXIT statement with condition is only executed when the condition evaluates Boolean true. The PROCESS statement can have either a sensitivity list or WAIT statements. There are four possible WAIT statements: WAIT; waits forever WAIT FOR time; waits for a given amount of time; WAIT ON signal [,signal]; waits for events on sensit. list WAIT UNTIL condition; waits until a condition is true - Modeling

16 Complete code example with different PROCESS and WAIT statements: ENTITY tst_process IS END tst_process; ARCHITECTURE arc_tst_process OF tst_process IS SIGNAL reset,clk,d,q1,q2,q3: BIT; stimuli d<=not d AFTER 25 ns; ps_wait_forever: PROCESS reset<='1', '0' AFTER 15 ns; WAIT; forever END PROCESS ps_wait_forever; ps_wait_for: PROCESS clk<=not clk; WAIT FOR 10 ns; END PROCESS ps_wait_for; ps_wait_on: PROCESS IF clk'event AND clk='1' THEN q1<=d AFTER 2 ns; END IF; WAIT ON clk; END PROCESS ps_wait_on; ps_sens_list: PROCESS(clk) IF clk'event AND clk='1' THEN q2<=d AFTER 2 ns; END IF; END PROCESS ps_sens_list; ps_wait_until: PROCESS q3<=not q3; WAIT UNTIL clk='1' AND q1='1'; END PROCESS ps_wait_until; END arc_tst_process; A PROCESS having neither sensitivity list nor WAIT statement is an endless loop. A PROCESS with WAIT statements runs from one WAIT statement to the next. END PROCESS is no end of loop, the PROCESS continues immediately with its first line. A PROCESS with sensitivity list corresponds to a WAIT ON statement with the same sensitivity list at the end of the process. Therefore, the VHDL loader runs through all processes during initialization until the next WAIT statement or the end of the process is reached. Values of variables get lost when the PROCESS execution halts between WAIT statements or waits for an event in the sensitivity list. - Modeling

17 Exercise: a) Compile, load and run the ENTITY tst_process for 100 ns. b) Which two processes in the code above must work per definition identical? c) Which two signals in the code example above must therefore behave identical? d) Can we rely on that a variable does not change its value when the PROCESS executes a WAIT statement? - Modeling

18 3.3.2 Signal Assignment in Sequential Environment A piece of sequential code delivers a maximum of one driver per signal. This is different from concurrent code, where multiply driven signals require a resolution function, because all drivers are assumed to drive simultaneously. In the following example we have: 1. a waveform assignment for signal s0, 2. multiple inertial assignments to signal s1, 3. three inertial assignments to signal s2, 4. multiple transport assignments to signal s3. ENTITY seq_sig_assign IS END seq_sig_assign; ARCHITECTURE arc_seq_sig_assign OF seq_sig_assign IS SIGNAL s0,s1,s2,s3: INTEGER:=0; PROCESS s0<=10 AFTER 10 ns, 20 AFTER 20 ns, 30 AFTER 30 ns, 40 AFTER 40 ns, 50 AFTER 50 ns; waveform assignment s1<=10 AFTER 10 ns; s1<=20 AFTER 20 ns; s1<=30 AFTER 30 ns; s1<=40 AFTER 40 ns; s1<=40 AFTER 50 ns; s1<=10 AFTER 35 ns; s2<=10 AFTER 10 ns; s2<=20 AFTER 20 ns; s2<=20 AFTER 30 ns; s3<=transport 10 AFTER 10 ns; s3<=transport 20 AFTER 20 ns; s3<=transport 30 AFTER 30 ns; s3<=transport 40 AFTER 40 ns; s3<=transport 50 AFTER 50 ns; s3<=transport 10 AFTER 35 ns; WAIT; forever END PROCESS; END arc_seq_sig_assign; Rule 1: Inertial signal assignment allows to schedule a maximum of 1 event. The latest assignment in sequential code cancels all other assignments. Rule 2: In exception to rule 1, an inertial scheduling in sequential code is ignored, if the scheduled value was already scheduled for an earlier time point. Rule 3: Transport signal assignment for time point t 3 cancels all scheduling for times t x t 3 and replaces it with the new scheduling. - Modeling

19 Exercise 3.2-5: a) Signal s1 is scheduled several times in the code example above. Express the behavior of signal s1 using a waveform assignment like for signal s0. Explain the result. b) Express the behavior of signal s2 using a waveform assignment like for signal s0. Explain the result. c) Express the behavior of signal s3 using a waveform assignment like for signal s0. Explain the result. d) Compile, load and run the driv_seq_inertial for 100 ns to check your estimations. - Modeling

20 3.4 Subprograms Subprograms are distinguished in PROCEDUREs and FUNCTIONs. Source code within subprograms is sequential and can use any sequential statement except processes and/or WAIT statements. Declaration: Subprograms can be declared in the declaration regions of ARCHITECTUREs or in PACKAGEs. Instantiation: Subprograms can be instantiated in concurrent environment (concurrent subprogram call) or in sequential environment (sequential subprogram call). In sequential environment a subprogram works similar to a PROCESS, which is invoked by an event on its sensitivity list. In sequential environment a subprogram is invoked by the statement sequence. Subprograms may contain subprograms. Table 3.4-1: Features of PROCEDUREs and FUNCTIONs: Feature PROCEDURE FUNCTION argument modi IN, OUT, INOUT IN argument classes CONSTANT, VARIABLE, SIGNAL CONSTANT, SIGNAL return values arbitrary (also 0) exactly 1 call statement part of expression RETURN statement optional obligatory Overloading: Subprograms can be overloaded, i.e. a subprogram is not only identified by its name, but also by the number and the data type(s) of its argument(s). An arbitrary number of subprograms with identical names but different arguments may be compiled. The two FUNCTION calls value<=f_maximum(a,b); value<=f_maximum(a,b,c); allow for a clear distinction by the number of arguments. If subprogram declarations cannot be distinguished by name and arguments, the later compilation overwrites the earlier compilation. Example for a procedure call: p_label: procedure_name(a,b,c,u,v,x,y); - Modeling

21 3.4.1 PROCEDUREs PROCEDURE declaration The PROCEDURE statement as used in the declaration region of an ARCHITECTURE or a PACKAGE BODY is Package: PROCEDURE procedure_name(...); Package Body or architecture declaration region: PROCEDURE procedure_name(...) IS executable VHDL code END procedure_name; For a package user the subprogram is visible only if it is mentioned in the package header. Otherwise it can be used only in the package body below its declaration. BNF: subprogram_specification ::= PROCEDURE designator [ ( formal_parameter_list ) ] [ PURE IMPURE ] FUNCTION designator [ ( formal_parameter_list ) ] RETURN type_mark Between IS and declarations can be made, between and END executable code can be inserted. In case of declaration in an ARCHITECTURE, the procedure is available inside the ARCHITECTURE only. In case of declaration in a PACKAGE BODY, the procedure is available inside the PACKAGE BODY and can be made visible to all users of the PACKAGE if this contains the interface declaration PROCEDURE procedure_name(...); PROCEDURE arguments have an argument class defining the data object type, i.e. SIGNAL, VARIABLE or CONSTANT. (Remember: ENTITY PORTs are always SIGNALS, ENTITY GENERICs are always constants.) Possible argument modi are IN, INOUT, OUT. Code Example: PROCEDURE procedure_name(constant a,b,c:in BIT; VARIABLE u,v:inout BIT; SIGNAL x,y:out BIT); - Modeling

22 Arguments of mode IN may have the classes CONSTANT, which is default, and SIGNAL and both cannot be assigned inside the subprogram due to mode IN. A SIGNAL has attributes while a CONSTANT has not. Arguments of mode OUT and INOUT may have the classes SIGNAL, VARIABLE and CONSTANT. Arguments of mode IN may be given default values by appending ":=default_value" to the respective argument declaration PROCEDURE instantiation Example for a procedure call: p_label: procedure_name(a,b,c,u,v,x,y); FUNCTIONs FUNCTION declaration The FUNCTION statement as used in the declaration region of an ARCHITECTURE or a PACKAGE BODY is Package Body: FUNCTION function_name(...) RETURN data_type IS VARIABLE CONSTANT SIGNAL ALIAS RETURN <data_type> END function_name; Between IS and declarations can be made, between and END executable code can be inserted. In case of declaration in an ARCHITECTURE, the function is available inside the ARCHITECTURE only. In case of declaration in a PACKAGE BODY, the function is available inside the PACKAGE BODY and can be made visible to all users of the PACKAGE if this contains the interface declaration FUNCTION function_name(...) RETURN data_type; As the only possible argument modus is IN the keyword IN may be omitted. - Modeling

23 The function delivers one return value. It must be returned with at least one RETURN statement of the form "RETURN return_value;". The return value may be any of data type, including ARRAY and RECORD. FUNCTION arguments have an argument class, i.e. SIGNAL, CONSTANT. Code Example for declaration in a PACKAGE: FUNCTION f_square(constant a:in REAL) RETURN REAL; FUNCTION f_square(a:real) RETURN REAL; equivalent due to defaults Code Example for declaration in a PACKAGE BODY or an ARCHITECTURE: FUNCTION f_square(a:real) RETURN REAL IS RETURN a*a; END f_square; Arguments may have the classes CONSTANT, which is default, and SIGNAL. Function arguments cannot be assigned inside the function. An input SIGNAL passes in attributes while a CONSTANT does not. Arguments may be given default values by appending ":=default_value" to the respective argument declaration FUNCTION calls Functions are a part of expressions matching the data type. Example: y<=f_square(x); actual_time:=now; now is a predefined FUNCTION without arguments Exercise: a) A FUNCTION returns exactly one data object. How can it return several scalar values? - Modeling

24 3.5 Some Advanced Topics Design Styles We distinguish three design styles: closed: no more decision can be made generic: a certain degree of freedom is left to adapt the design to specific applications configurable: the user can change the design in a very wide range. Closed style would be for example: TYPE t_databus IS std_ulogic_vector(15 DOWNTO 0); Latch<=DataBus AFTER 10 ns; Generic style would be in this example: CONSTANT c_buswidth:integer:=16; CONSTANT c_bufferdelay:time:=10 ns;.. TYPE t_databus IS std_ulogic_vector(c_buswidth-1 DOWNTO 0); Latch<=DataBus AFTER c_bufferdelay; This type of writing code is not only generic but also more readable. It contains the information c_buswidth-1 instead of 15. Furthermore, it is better suited for reusability, as the width of the bus is easily adapted with the constant c_buswidth and all delays are easily adapted to an other technology with the constant c_bufferdelay. This is the coding style that should be preferred. Configurable would be e.g. a digital filter of variable length with all coefficients adjustable. This is nice but expensive to test Modeling Styles Typically we find three kinds of VHDL code: Modeling Style Feature Applications behavioral non synthesizable testbenches, top-level, ext. devices (drives, etc.) RTL 1) synthesizable typically the code under development gate level primitives after synthesis, backannotation, timing 1) RTL = Register Transfer Level - Modeling

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden Synthesis from VHDL Krzysztof Kuchcinski Krzysztof.Kuchcinski@cs.lth.se Department of Computer Science Lund Institute of Technology Sweden March 23, 2006 Kris Kuchcinski (LTH) Synthesis from VHDL March

More information

VHDL: RTL Synthesis Basics. 1 of 59

VHDL: RTL Synthesis Basics. 1 of 59 VHDL: RTL Synthesis Basics 1 of 59 Goals To learn the basics of RTL synthesis. To be able to synthesize a digital system, given its VHDL model. To be able to relate VHDL code to its synthesized output.

More information

Hardware Description Languages. Modeling Complex Systems

Hardware Description Languages. Modeling Complex Systems Hardware Description Languages Modeling Complex Systems 1 Outline (Raising the Abstraction Level) The Process Statement if-then, if-then-else, if-then-elsif, case, while, for Sensitivity list Signals vs.

More information

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools ECE U530 Digital Hardware Synthesis Prof. Miriam Leeser mel@coe.neu.edu Sept 13, 2006 Lecture 3: Basic VHDL constructs Signals, Variables, Constants VHDL Simulator and Test benches Types Reading: Ashenden

More information

SEQUENTIAL STATEMENTS

SEQUENTIAL STATEMENTS SEQUENTIAL STATEMENTS Sequential Statements Allow to describe the behavior of a circuit as a sequence of related events Can be used to model, simulate and synthesize: Combinational logic circuits Sequential

More information

VHDL Examples Mohamed Zaky

VHDL Examples Mohamed Zaky VHDL Examples By Mohamed Zaky (mz_rasmy@yahoo.co.uk) 1 Half Adder The Half Adder simply adds 2 input bits, to produce a sum & carry output. Here we want to add A + B to produce Sum (S) and carry (C). A

More information

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\ CSCI 250 - Lab 3 VHDL Syntax Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\ Objectives 1. Learn VHDL Valid Names 2. Learn the presentation of Assignment and Comments 3. Learn Modes, Types, Array,

More information

Sequential VHDL. Katarzyna Radecka. DSD COEN 313

Sequential VHDL. Katarzyna Radecka. DSD COEN 313 Sequential VHDL Katarzyna Radecka DSD COEN 313 kasiar@ece.concordia.ca Overview Process Sensitivity List Wait Statements If Statements Case Statements Loop Statements Three Styles of VHDL Behavioral Structural

More information

VHDL And Synthesis Review

VHDL And Synthesis Review VHDL And Synthesis Review VHDL In Detail Things that we will look at: Port and Types Arithmetic Operators Design styles for Synthesis VHDL Ports Four Different Types of Ports in: signal values are read-only

More information

C-Based Hardware Design

C-Based Hardware Design LECTURE 6 In this lecture we will introduce: The VHDL Language and its benefits. The VHDL entity Concurrent and Sequential constructs Structural design. Hierarchy Packages Various architectures Examples

More information

CprE 583 Reconfigurable Computing

CprE 583 Reconfigurable Computing Recap Moore FSM Example CprE / ComS 583 Reconfigurable Computing Moore FSM that recognizes sequence 10 0 1 0 1 S0 / 0 S1 / 0 1 S2 / 1 Prof. Joseph Zambreno Department of Electrical and Computer Engineering

More information

Introduction to VHDL. Main language concepts

Introduction to VHDL. Main language concepts Introduction to VHDL VHSIC (Very High Speed Integrated Circuit) Hardware Description Language Current standard is IEEE 1076-1993 (VHDL-93). Some tools still only support VHDL-87. Tools used in the lab

More information

Building Blocks. Entity Declaration. Entity Declaration with Generics. Architecture Body. entity entity_name is. entity register8 is

Building Blocks. Entity Declaration. Entity Declaration with Generics. Architecture Body. entity entity_name is. entity register8 is Building Blocks Entity Declaration entity entity_name is [signal] identifier {, identifier}: [mode] signal_type {; [signal] identifier {, identifier}: [mode] signal_type}); end [entity ] [entity_name];

More information

Control and Datapath 8

Control and Datapath 8 Control and Datapath 8 Engineering attempts to develop design methods that break a problem up into separate steps to simplify the design and increase the likelihood of a correct solution. Digital system

More information

Introduction to VHDL #1

Introduction to VHDL #1 ECE 3220 Digital Design with VHDL Introduction to VHDL #1 Lecture 3 Introduction to VHDL The two Hardware Description Languages that are most often used in industry are: n VHDL n Verilog you will learn

More information

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 4 Introduction to VHDL

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 4 Introduction to VHDL EE 459/500 HDL Based Digital Design with Programmable Logic Lecture 4 Introduction to VHDL Read before class: Chapter 2 from textbook (first part) Outline VHDL Overview VHDL Characteristics and Concepts

More information

JUNE, JULY 2013 Fundamentals of HDL (10EC45) PART A

JUNE, JULY 2013 Fundamentals of HDL (10EC45) PART A JUNE, JULY 2013 Fundamentals of HDL (10EC45) Time: 3hrs Max Marks:100 Note: Answer FIVE full questions, selecting at least TWO questions from each part. PART A Q1.a. Describe VHDL scalar data types with

More information

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements EECE-4740/5740 Advanced VHDL and FPGA Design Lecture 3 Concurrent and sequential statements Cristinel Ababei Marquette University Department of Electrical and Computer Engineering Overview Components hierarchy

More information

Basic Language Concepts

Basic Language Concepts Basic Language Concepts Sudhakar Yalamanchili, Georgia Institute of Technology ECE 4170 (1) Describing Design Entities a sum b carry Primary programming abstraction is a design entity Register, logic block,

More information

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design Two HDLs used today Introduction to Structured VLSI Design VHDL I VHDL and Verilog Syntax and ``appearance'' of the two languages are very different Capabilities and scopes are quite similar Both are industrial

More information

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

!#$%&&'(')*+%,%-.#'/'.001$$ !"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"!!"#$%&'#()#*+"+#,-."/0110#230#4."50",+"+#)6# 6+-+#(.6+-0#)4475.8)60#0/#.65-0#230#9+**+"+# 2.48).-0#(.6+-0#! 2+"*5."5*:#,."/0110#;)**0! *),".6*:#-.99-0*0"5."+#2+660,.40"5)#;)*)2)#

More information

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006 310/1780-10 ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006 VHDL & FPGA - Session 2 Nizar ABDALLH ACTEL Corp. 2061 Stierlin Court

More information

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language VHDL Introduction to Structured VLSI Design VHDL I Very High Speed Integrated Circuit (VHSIC) Hardware Description Language Joachim Rodrigues A Technology Independent, Standard Hardware description Language

More information

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009 2065-15 Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis 26 October - 20 November, 2009 FPGA Architectures & VHDL Introduction to Synthesis Nizar Abdallah ACTEL Corp.2061

More information

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14 COE 405, Term 062 Design & Modeling of Digital Systems HW# 1 Solution Due date: Wednesday, March. 14 Q.1. Consider the 4-bit carry-look-ahead adder (CLA) block shown below: A 3 -A 0 B 3 -B 0 C 3 4-bit

More information

Part IV. Behavioural Description Using VHDL

Part IV. Behavioural Description Using VHDL Part IV Behavioural Description Using 4 Behavioural Description 5 Array attributes Type Signal attributes Behavioural Style Behavioural style describes a design in terms of its behaviour, and not in terms

More information

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group Hardware Modeling VHDL Syntax Vienna University of Technology Department of Computer Engineering ECS Group Contents Identifiers Types & Attributes Operators Sequential Statements Subroutines 2 Identifiers

More information

Summary of FPGA & VHDL

Summary of FPGA & VHDL FYS4220/9220 Summary of FPGA & VHDL Lecture #6 Jan Kenneth Bekkeng, University of Oslo - Department of Physics 16.11.2011 Curriculum (VHDL & FPGA part) Curriculum (Syllabus) defined by: Lectures Lecture6:

More information

Review of Digital Design with VHDL

Review of Digital Design with VHDL Review of Digital Design with VHDL Digital World Digital world is a world of 0 and 1 Each binary digit is called a bit Eight consecutive bits are called a byte Hexadecimal (base 16) representation for

More information

VHDL. Chapter 7. Behavioral Modeling. Outline. Behavioral Modeling. Process Statement

VHDL. Chapter 7. Behavioral Modeling. Outline. Behavioral Modeling. Process Statement Chapter 7 VHDL VHDL - Flaxer Eli Ch 7-1 Process Statement Outline Signal Assignment Statement Variable Assignment Statement Wait Statement If-Then-Else Statement Case Statement Null Statement Loop Statement

More information

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized Multi-valued Logic Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized X, unknown 0, logic 0 1, logic 1 Z, high impedance W, unknown L, logic 0 weak H, logic 1 weak - ); don t care Standard

More information

N-input EX-NOR gate. N-output inverter. N-input NOR gate

N-input EX-NOR gate. N-output inverter. N-input NOR gate Hardware Description Language HDL Introduction HDL is a hardware description language used to design and document electronic systems. HDL allows designers to design at various levels of abstraction. It

More information

ECE 3401 Lecture 10. More on VHDL

ECE 3401 Lecture 10. More on VHDL ECE 3401 Lecture 10 More on VHDL Outline More on VHDL Some VHDL Basics Data Types Operators Delay Models VHDL for Simulation VHDL for Synthesis 1 Data Types Every signal has a type, type specifies possible

More information

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2 VHDL 2 Combinational Logic Circuits Reference: Roth/John Text: Chapter 2 Combinational logic -- Behavior can be specified as concurrent signal assignments -- These model concurrent operation of hardware

More information

Lecture 10 Subprograms & Overloading

Lecture 10 Subprograms & Overloading CPE 487: Digital System Design Spring 2018 Lecture 10 Subprograms & Overloading Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 1 Subprograms

More information

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory Instructor John Chandy Office: ITEB 437 Office Hours: W10-12 Tel: (860) 486-5047 Email: john.chandy@uconn chandy@uconn.edu Class home page: HuskyCT

More information

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN Lecture 9 VHDL, part IV Hierarchical and parameterized design Section 1 HIERARCHICAL DESIGN 2 1 Dealing with Large Digital System Design 1. Apply hierarchy to the design At the highest level use larger

More information

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University Hardware description language (HDL) Intended to describe circuits textually, for a computer to read Evolved starting in the 1970s and 1980s Popular languages today include: VHDL Defined in 1980s by U.S.

More information

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit VHDL VHDL Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit VHDL Alternative (Student Generated) Definition Very Hard Digital Logic language VHDL Design

More information

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University 1 The Wait Statement Syntax wait until condition; Different forms wait until(clk event and clk = 1 ); wait

More information

Lecture 12 VHDL Synthesis

Lecture 12 VHDL Synthesis CPE 487: Digital System Design Spring 2018 Lecture 12 VHDL Synthesis Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 1 What is Synthesis?

More information

Hardware Description Language VHDL (1) Introduction

Hardware Description Language VHDL (1) Introduction Hardware Description Language VHDL (1) Introduction Digital Radiation Measurement and Spectroscopy NE/RHP 537 Introduction Hardware description language (HDL) Intended to describe circuits textually, for

More information

COE 405 Design Methodology Based on VHDL

COE 405 Design Methodology Based on VHDL COE 405 Design Methodology Based on VHDL Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Outline Elements of VHDL Top-Down Design Top-Down Design with

More information

Subprograms, Packages, and Libraries

Subprograms, Packages, and Libraries Subprograms, Packages, and Libraries Sudhakar Yalamanchili, Georgia Institute of Technology ECE 4170 (1) function rising_edge (signal clock: std_logic) return boolean is declarative region: declare variables

More information

Test Benches - Module 8

Test Benches - Module 8 Test Benches Module 8 Jim Duckworth, WPI 1 Overview We have concentrated on VHDL for synthesis Can also use VHDL as a test language Very important to conduct comprehensive verification on your design To

More information

Synthesizable Verilog

Synthesizable Verilog Synthesizable Verilog Courtesy of Dr. Edwards@Columbia, and Dr. Franzon@NCSU http://csce.uark.edu +1 (479) 575-6043 yrpeng@uark.edu Design Methodology Structure and Function (Behavior) of a Design HDL

More information

Lattice VHDL Training

Lattice VHDL Training Lattice Part I February 2000 1 VHDL Basic Modeling Structure February 2000 2 VHDL Design Description VHDL language describes a digital system as a set of modular blocks. Each modular block is described

More information

Writing VHDL for RTL Synthesis

Writing VHDL for RTL Synthesis Writing VHDL for RTL Synthesis Stephen A. Edwards, Columbia University December 21, 2009 The name VHDL is representative of the language itself: it is a two-level acronym that stands for VHSIC Hardware

More information

Embedded Systems CS - ES

Embedded Systems CS - ES Embedded Systems - 1 - REVIEW Hardware/System description languages VDHL VHDL-AMS SystemC TLM - 2 - VHDL REVIEW Main goal was modeling of digital circuits Modelling at various levels of abstraction Technology-independent

More information

Modeling Complex Behavior

Modeling Complex Behavior Modeling Complex Behavior Sudhakar Yalamanchili, Georgia Institute of Technology, 2006 (1) Outline Abstraction and the Process Statement Concurrent processes and CSAs Process event behavior and signals

More information

Inthis lecture we will cover the following material:

Inthis lecture we will cover the following material: Lecture #8 Inthis lecture we will cover the following material: The standard package, The std_logic_1164 Concordia Objects & data Types (Signals, Variables, Constants, Literals, Character) Types and Subtypes

More information

Lab # 2. Sequential Statements

Lab # 2. Sequential Statements The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4111: Digital System Lab Lab # 2 Sequential Statements Eng. Alaa O Shama September, 2015 Introduction In this

More information

3 Designing Digital Systems with Algorithmic State Machine Charts

3 Designing Digital Systems with Algorithmic State Machine Charts 3 Designing with Algorithmic State Machine Charts An ASM chart is a method of describing the sequential operations of a digital system which has to implement an algorithm. An algorithm is a well defined

More information

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library : UNIT I Introduction to VHDL VHDL stands for very high-speed integrated circuit hardware description language. Which is one of the programming languages used to model a digital system by dataflow, behavioral

More information

VHDL simulation and synthesis

VHDL simulation and synthesis VHDL simulation and synthesis How we treat VHDL in this course You will not become an expert in VHDL after taking this course The goal is that you should learn how VHDL can be used for simulation and synthesis

More information

ENGR 5865 DIGITAL SYSTEMS

ENGR 5865 DIGITAL SYSTEMS ENGR 5865 DIGITAL SYSTEMS ModelSim Tutorial Manual January 22, 2007 Introduction ModelSim is a CAD tool widely used in the industry for hardware design. This document describes how to edit/add, compile

More information

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits M1 Informatique / MOSIG Introduction to Modeling and erification of Digital Systems Part 4: HDL for sequential circuits Laurence PIERRE http://users-tima.imag.fr/amfors/lpierre/m1arc 2017/2018 81 Sequential

More information

CPE/EE 422/522. Chapter 8 - Additional Topics in VHDL. Dr. Rhonda Kay Gaede UAH. 8.1 Attributes - Signal Attributes that return a value

CPE/EE 422/522. Chapter 8 - Additional Topics in VHDL. Dr. Rhonda Kay Gaede UAH. 8.1 Attributes - Signal Attributes that return a value CPE/EE 422/522 Chapter 8 - Additional Topics in VHDL Dr. Rhonda Kay Gaede UAH 1 8.1 Attributes - Signal Attributes that return a value A event true if a has just occurred A active true if A has, even if

More information

VHDL Sequential Statements. Cristian Sisterna

VHDL Sequential Statements. Cristian Sisterna VHDL Sequential Statements MSc. Cristian Sisterna 1 Sequential Statements Allow to describe the behavior of a circuit as a sequence of related events Can be used to model, simulate and synthesize: Combinational

More information

1. Using the for-generahon scheme, concurrent statements can be replicated a predetermined number of times.

1. Using the for-generahon scheme, concurrent statements can be replicated a predetermined number of times. Generate Statements Concurrent statements can be conditionally selected or replicated during the elaboration phase using the generate statement. There are two forms of the generate statement. 1. Using

More information

[VARIABLE declaration] BEGIN. sequential statements

[VARIABLE declaration] BEGIN. sequential statements PROCESS statement (contains sequential statements) Simple signal assignment statement

More information

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks. Outline CPE/EE 422/522 Advanced Logic Design L05 Electrical and Computer Engineering University of Alabama in Huntsville What we know Combinational Networks Sequential Networks: Basic Building Blocks,

More information

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab Department of Electronics & Communication Engineering Lab Manual E-CAD Lab Prasad V. Potluri Siddhartha Institute of Technology (Sponsored by: Siddhartha Academy of General & Technical Education) Affiliated

More information

Mridula Allani Fall Fall

Mridula Allani Fall Fall Mridula Allani Fall 2010 Fall 2010 1 Model and document digital systems Hierarchical models System, RTL (Register Transfer Level), gates Different levels of abstraction Behavior, structure Verify circuit/system

More information

IT T35 Digital system desigm y - ii /s - iii

IT T35 Digital system desigm y - ii /s - iii UNIT - V Introduction to Verilog Hardware Description Language Introduction HDL for combinational circuits Sequential circuits Registers and counters HDL description for binary multiplier. 5.1 INTRODUCTION

More information

Sequential Logic - Module 5

Sequential Logic - Module 5 Sequential Logic Module 5 Jim Duckworth, WPI 1 Latches and Flip-Flops Implemented by using signals in IF statements that are not completely specified Necessary latches or registers are inferred by the

More information

EEL 4783: Hardware/Software Co-design with FPGAs

EEL 4783: Hardware/Software Co-design with FPGAs EEL 4783: Hardware/Software Co-design with FPGAs Lecture 9: Short Introduction to VHDL* Prof. Mingjie Lin * Beased on notes of Turfts lecture 1 What does HDL stand for? HDL is short for Hardware Description

More information

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems EE 3610: Digital Systems 1 Lecture 4: Modeling in VHDL (Continued ) Sequential Statements Use Process process (sensitivity list) variable/constant declarations Sequential Statements end process; 2 Sequential

More information

The process. Sensitivity lists

The process. Sensitivity lists The process process itself is a concurrent statement but the code inside the process is executed sequentially Process label (optional) Process declarative region Process body entity Test is, : in bit;

More information

APPLICATION NOTE. A CPLD VHDL Introduction. Introduction. Overview. Entity. XAPP 105 January12, 1998 (Version 1.0) 0 4* Application Note

APPLICATION NOTE. A CPLD VHDL Introduction. Introduction. Overview. Entity. XAPP 105 January12, 1998 (Version 1.0) 0 4* Application Note 0 APPLICATION NOTE A CPLD VHDL Introduction XAPP 105 January12, 1998 Version 1.0) 0 4* Application Note Summary This introduction covers the basics of VHDL as applied to Complex Programmable Logic Devices.

More information

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

ECE Digital Design Laboratory. Lecture 3 Finite State Machines! ECE 4401 - Digital Design Laboratory Lecture 3 Finite State Machines! 1!!!! Synchronous Sequential Circuits!!! Synchronous sequential logic circuits are realized using combinational logic and storage elements

More information

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

Hardware Modeling. VHDL Basics. ECS Group, TU Wien Hardware Modeling VHDL Basics ECS Group, TU Wien VHDL Basics 2 Parts of a Design Unit Entity Architecture Configuration Package Package Package Body Library How to create a Design Unit? Interface to environment

More information

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 Anurag Dwivedi Digital Design : Bottom Up Approach Basic Block - Gates Digital Design : Bottom Up Approach Gates -> Flip Flops Digital

More information

Chapter 6 Combinational-Circuit Building Blocks

Chapter 6 Combinational-Circuit Building Blocks Chapter 6 Combinational-Circuit Building Blocks Commonly used combinational building blocks in design of large circuits: Multiplexers Decoders Encoders Comparators Arithmetic circuits Multiplexers A multiplexer

More information

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs Logic and Computer Design Fundamentals VHDL Part Chapter 4 Basics and Constructs Charles Kime & Thomas Kaminski 24 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Overview

More information

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified. 1 In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified. I will also introduce the idea of a testbench as part of a design specification.

More information

Lecture 3 Introduction to VHDL

Lecture 3 Introduction to VHDL CPE 487: Digital System Design Spring 2018 Lecture 3 Introduction to VHDL Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 1 Managing Design

More information

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL IE24 Digital Design L7: Combinational circuits, Introduction to VHDL Elena Dubrova KTH / ICT / ES dubrova@kth.se This lecture BV 38-339, 6-65, 28-29,34-365 IE24 Digital Design, HT 24 2 The multiplexer

More information

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs. CPE 626 Lecture 4: VHDL Recapitulation (Part 2) Aleksandar Milenkovic http://www.ece.uah.edu/~milenka http://www.ece.uah.edu/~milenka/cpe626-04f/ milenka@ece.uah.edu Assistant Professor Electrical and

More information

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX Outline CPE/EE 422/522 Advanced Logic Design L07 Electrical and Computer Engineering University of Alabama in Huntsville What we know How to model Combinational Networks in VHDL Structural, Dataflow, Behavioral

More information

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1 Verilog Synthesis Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis Spring 2007 Lec #8 -- HW Synthesis 1 Logic Synthesis Verilog and VHDL started out

More information

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) - Sistemas Digitais I LESI - 2º ano Lesson 5 - VHDL Prof. João Miguel Fernandes (miguel@di.uminho.pt) Dept. Informática - Introduction - VHDL was developed, in the mid-1980s, by DoD and IEEE. VHDL stands

More information

Lecture 32: SystemVerilog

Lecture 32: SystemVerilog Lecture 32: SystemVerilog Outline SystemVerilog module adder(input logic [31:0] a, input logic [31:0] b, output logic [31:0] y); assign y = a + b; Note that the inputs and outputs are 32-bit busses. 17:

More information

A bird s eye view on VHDL!

A bird s eye view on VHDL! Advanced Topics on Heterogeneous System Architectures A bird s eye view on VHDL Politecnico di Milano Conference Room, Bld 20 19 November, 2015 Antonio R. Miele Marco D. Santambrogio Politecnico di Milano

More information

COE 405 Behavioral Descriptions in VHDL

COE 405 Behavioral Descriptions in VHDL COE 405 Behavioral Descriptions in VHDL Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals Outline Constructs for Sequential Descriptions Process Statement

More information

Introduction to VHDL #3

Introduction to VHDL #3 ECE 322 Digital Design with VHDL Introduction to VHDL #3 Lecture 7 & 8 VHDL Modeling Styles VHDL Modeling Styles Dataflow Concurrent statements Structural Components and interconnects Behavioral (sequential)

More information

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23 98-1 Under-Graduate Project Synthesis of Combinational Logic Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23 What is synthesis? Outline Behavior Description for Synthesis Write Efficient HDL

More information

Lab # 5. Subprograms. Introduction

Lab # 5. Subprograms. Introduction Lab # 5 Subprograms Introduction Subprograms consist of procedures and functions. A procedure can return more than one argument; a function always returns just one. In a function, all parameters are input

More information

Concurrent Signal Assignment Statements (CSAs)

Concurrent Signal Assignment Statements (CSAs) Concurrent Signal Assignment Statements (CSAs) Digital systems operate with concurrent signals Signals are assigned values at a specific point in time. VHDL uses signal assignment statements Specify value

More information

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language) Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits Hardware Description Language) 1 Standard ICs PLD: Programmable Logic Device CPLD: Complex PLD FPGA: Field Programmable

More information

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez Introduction to VHDL Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez What is VHDL? Very High Speed Integrated Circuit Hardware

More information

VHDL for Synthesis. Course Description. Course Duration. Goals

VHDL for Synthesis. Course Description. Course Duration. Goals VHDL for Synthesis Course Description This course provides all necessary theoretical and practical know how to write an efficient synthesizable HDL code through VHDL standard language. The course goes

More information

Lecture 5: State Machines, Arrays, Loops. EE 3610 Digital Systems

Lecture 5: State Machines, Arrays, Loops. EE 3610 Digital Systems EE 3610: Digital Systems 1 Lecture 5: State Machines, Arrays, Loops BCD to Excess-3 (XS 3 ) Code Converter Example: Fig. 2-53 2 Easier to use one type of code (e.g. XS 3 ) over the other type (e.g. BCD)

More information

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad - 00 0 ELECTRONICS AND COMMUNICATIONS ENGINEERING QUESTION BANK Course Name : DIGITAL DESIGN USING VERILOG HDL Course Code : A00 Class : II - B.

More information

EE 595. Part II Design Units in VHDL. EE 595 EDA / ASIC Design Lab

EE 595. Part II Design Units in VHDL. EE 595 EDA / ASIC Design Lab EE 595 Part II Design Units in VHDL Design Units There are five type of design units in VHDL: Entities Architectures Packages Package Bodies Configurations Entities and architectures are the only two design

More information

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University ECE 545 Lecture 5 Data Flow Modeling in VHDL George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 4, Concurrent Signal Assignment Statements of VHDL 2 Types of VHDL Description

More information

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006 The University of Alabama in Huntsville ECE Department CPE 526 01 Midterm Exam Solution March 2, 2006 1. (15 points) A barrel shifter is a shift register in which the data can be shifted either by one

More information

MLR Institute of Technology

MLR Institute of Technology MLR Institute of Technology Laxma Reddy Avenue, Dundigal, Quthbullapur (M), Hyderabad 500 043 Course Name Course Code Class Branch ELECTRONICS AND COMMUNICATIONS ENGINEERING QUESTION BANK : DIGITAL DESIGN

More information

Design units can NOT be split across different files

Design units can NOT be split across different files Skeleton of a Basic VHDL Program This slide set covers the components to a basic VHDL program, including lexical elements, program format, data types and operators A VHDL program consists of a collection

More information

Computer-Aided Digital System Design VHDL

Computer-Aided Digital System Design VHDL بس م اهلل الر حم ن الر حی م Iran University of Science and Technology Department of Computer Engineering Computer-Aided Digital System Design VHDL Ramin Rajaei ramin_rajaei@ee.sharif.edu Modeling Styles

More information