Skip to content

Commit 578b249

Browse files
committed
wait until
1 parent b9d8529 commit 578b249

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ Testbench will run, print results and then stop automatically.
3232
* Different wait statements with process.
3333
* Example components?
3434
* Three main different ways to implement state machines.
35+
* Use VUnit to implement basic testing examples.

language-features/context/test_lib/lib_context.vhd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Declare context which can be used in some other design with context
22
-- keyword. This is like an entry point to this library.
3-
-- Using context make inlcuding multiple libraries less tedious and
3+
-- Using context make including multiple libraries less tedious and
44
-- easier. This context is compiled to test_lib library.
55
context lib_context is
66
library ieee;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
builder = msim
2+
target_dir = .build
3+
4+
vhdl work wait-until.vhd -2002
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
-- Wait until statement can be used in processes to suspend its execution until
2+
-- given expressions becomes true.
3+
4+
-- This example code will print following messages:
5+
-- Note: before wait until
6+
-- Note: after wait until
7+
-- Note: before wait until
8+
-- Failure: simulation ended
9+
10+
library ieee;
11+
use ieee.std_logic_1164.all;
12+
13+
14+
entity wait_until is
15+
end entity;
16+
17+
18+
architecture tb of wait_until is
19+
20+
signal test : boolean := false;
21+
signal end_simulation : boolean := true;
22+
23+
begin
24+
25+
test <= true after 1 ps;
26+
27+
-- Process will execute until wait statement and suspends until test signal
28+
-- changes to true. After that execution continues until wait statements is
29+
-- executed again. This causes process to be suspended again until event
30+
-- happens on the test signal. This is the reason also why first message is
31+
-- printed twice.
32+
main : process
33+
begin
34+
report "before wait until";
35+
wait until test;
36+
report "after wait until";
37+
end process;
38+
39+
end_simulation <= false after 2 ps;
40+
assert end_simulation
41+
report "simulation ended"
42+
severity failure;
43+
44+
end architecture;

run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
vu = VUnit.from_argv()
44
lib = vu.add_library('lib')
5-
lib.add_source_files("components/arithmetic/array-multiplier/*.vhd")
5+
lib.add_source_files("components-and-cores/arithmetic/array-multiplier/*.vhd")
66
vu.main()

0 commit comments

Comments
 (0)