Professional Documents
Culture Documents
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
A process can assign value to more than one signal and contain sequential statements.
Declarative part: variable, file, or constant objects can be declared. They are only visible to this process. Signals and constants declared in an
architecture that encloses a process statement can be used inside the process. Such signals are the only means of communication between processes.
Initialization of the process objects is done only once at the beginning of a simulation run. It is not true for a subprogram.
Statement part: is sequential, when it is active, the program flow reaches the last sequential statement, the execution returns to the first statement and
continues. It executes in zero (delta time for signals) time. For selection and assignment: "IF", LOOP", and CASE" statements. Conditional and
selected assignments are strictly concurrent and are not allowed.
Sensitivity List.
Sensitivity list is a mechanism for suspending and subsequently conditionally activating a process. Remember it has the format:
PROCESS (a list of signals)
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
1/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
Process Example 1:
2/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
Now internal state is realized by the use of a signal - state. There are three
concurrent statements in the architecture body : one is the PROCESS and the
other two are the dataflow assignment of q and qb. Therefore, there are two
simulation cycles between input and output changes: One for assignment of
values to state', and one for assignment state' to q (qb). So at least 2
delta delays is present.
Another architecture is shown in the following. For zero delay parameter
values, it reduces the delay to one delta.
-- one delta delay
ENTITY d_sr_flipflop IS
GENERIC (sq_delay : TIME := 5 NS; rq_delay : TIME := 4 NS;
cq_delay : TIME := 6 NS);
PORT (d, set, rst, clk : IN BIT; q : OUT BIT; qb : OUT BIT := '1');
END d_sr_flipflop;
-ARCHITECTURE one_delta OF d_sr_flipflop IS
SIGNAL state : BIT := '0';
BEGIN
dff: PROCESS (rst, set, clk)
VARIABLE state : BIT := 0;
BEGIN
IF set = '1' THEN
state := '1';
ELSIF rst = '1' THEN
state := '0';
ELSIF clk = '1' AND clk'EVENT THEN
state := d;
END IF;
q <= state AFTER (sq_delay+rq_delay+cq_delay)/3;
qb <= NOT state AFTER (sq_delay+rq_delay+cq_delay)/3;
END PROCESS dff;
END one_delta;
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
3/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
4/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
-- In order to remove all delta delays even in the case of zero propagation
-- delays, we have avoided the use of an intermediate signal. Because of
-- this, two assignments are needed for assigning values to q and qb.
-- Another side-effect of this method is that initially assignments to
-- the two outputs will not be executed, causing both outputs to start at
-- zero (initial value of BIT). To overcome this problem, a default value
-- of '1' is used for the qb output.
--- ns set rst d clk q qb
-- 0 0 0 0 0 0 1
-- 100 1 0 0 0 0 1
-- 105 1 0 0 0 1 0
-- 300 0 0 0 0 1 0
-- 400 0 1 0 0 1 0
-- 404 0 1 0 0 0 1
-- 500 0 1 1 0 0 1
-- 600 0 1 1 1 0 1
-- 800 0 0 1 1 0 1
--1000 0 0 1 0 0 1
--1200 0 0 1 1 0 1
--1206 0 0 1 1 1 0
--1400 0 0 0 1 1 0
--1600 0 0 0 0 1 0
--1700 0 0 0 1 1 0
--1706 0 0 0 1 0 1
--1800 1 0 0 1 0 1
--1805 1 0 0 1 1 0
We have already examine the LOOP statement with indeices. We can also write loop statements
without an iteration scheme (i.e. without FOR or WHILE). It is an infinite loop.
The only way to exit is to use an exit statement. An example is shown in the following:
long_running: LOOP
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
5/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
...
IF x=25 THEN EXIT;
END IF;
...
END LOOP long_running;
An exit statement causes the termination of the loop. The condition can be
satisfied also with the WHEN construct.
LOOP
WAIT ON a, b;
EXIT WHEN a = b;
END LOOP;
-- this is the same as WAIT UNTIL a = b;
Besides EXIT another construct that can be used with the LOOP statement is NEXT.
A NEXT statement (within a loop) causes the rest of the loop be skipped and the
NEXT iteration to be taken. The syntax takes the following form:
NEXT loop_label WHEN condition; -- without label, the innermost enclosing loop;
EXIT WHEN x=25
6/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
NULL;
END IF;
k := k + 1;
END LOOP;
In this example, when the NEXT statement is executed, execution jumps to the end of the loop (the
last statement, "k := k + 1;", is not executed!), decrement j and resume the LOOP with the new
value of j.
Inclusion of labels enables to go to selected outer loops. A simple example is given here:
Also see code in Fig. 9.16.
-- while in the loop_2, if after the execution of sequential_statement_4
condition_1 is TRUE, the next' statement causes the remainder of loop_2
and loop_1 to be skipped, and the next iteration of loop_1 is taken.
-- therefore, the value of i=i+1 and sequential_statement_1 will be executed.
Assertion Statement
ASSERT
(good condition)
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
7/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
REPORT
(if good condition is violated)
SEVERITY
Some times it is easier to ASSERT the bad thingss ince there are too many
good things to list.
ASSERT
NOT things should not happen
REPORT
message that a bad thing has happened
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
8/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
(NOT
clock'STABLE(hold_time))
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
10/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
11/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
Fig. 9.25
12/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
Implementing Handshaking
Comprehensive example:
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
13/14
1/4/2016
web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
System_i waits in an idle state looking for in_ready to become `1`. When
this happens, it receives data from in_data and acknowledges it by
placing a `1` on in_received. The interface holds in_received active
until in_ready becomes `0`. On the other side, system_i talks to system_b
by providing data on the out_data output bus, and by activating the
out_ready line, informs the other system of the new data. When system_b
receives the data, it places a `1` on the out_received line,
and holds this line active until system_i deactivates its out_ready
output.
http://web.engr.oregonstate.edu/~sllu/vhdl/lec7a.html
14/14