File tree 3 files changed +21
-2
lines changed
language-features/context 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change
1
+ -- Make library visible to design.
1
2
library test_lib;
3
+ -- Apply test_lib context to this design. This will include context includes
4
+ -- visible to this design. No need to write or import ieee stuff.
2
5
context test_lib.lib_context;
3
6
4
7
@@ -8,11 +11,20 @@ end entity;
8
11
9
12
architecture tb of test is
10
13
11
- signal test : std_logic := '1' ;
14
+ -- std_logic type available because of the context.
15
+ signal a, b, s : std_logic := '0' ;
16
+ signal d : std_logic ;
12
17
signal end_simulation : boolean := true ;
13
18
14
19
begin
15
- -- TODO: Write rest of this here.
20
+
21
+ -- Mux component available because of the context.
22
+ mux1 : entity mux port map (a, b, s, d);
23
+
24
+ end_simulation <= false after 1 ps ;
25
+ assert end_simulation
26
+ report " simulation ended"
27
+ severity failure ;
16
28
17
29
end architecture ;
18
30
Original file line number Diff line number Diff line change
1
+ -- Declare context which can be used in some other design with context
2
+ -- keyword. This is like an entry point to this library.
3
+ -- Using context make inlcuding multiple libraries less tedious and
4
+ -- easier. This context is compiled to test_lib library.
1
5
context lib_context is
2
6
library ieee;
3
7
use ieee.std_logic_1164.all ;
8
+ -- Notice no library statement needed, because this file is compiled
9
+ -- to the test_lib library.
4
10
use test_lib.all ;
5
11
end context;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ library ieee;
2
2
use ieee.std_logic_1164.all ;
3
3
4
4
5
+ -- Compiled to test_lib library.
5
6
entity mux is
6
7
port (
7
8
a, b, s : in std_logic ;
You can’t perform that action at this time.
0 commit comments