forked from salb545/VHDLWhizCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsim_subprograms_pck.vhd
More file actions
53 lines (41 loc) · 1.18 KB
/
sim_subprograms_pck.vhd
File metadata and controls
53 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
library ieee;
use ieee.std_logic_1164.all;
use std.textio.all;
library dot_matrix_sim;
use dot_matrix_sim.constants.all;
use dot_matrix_sim.types.all;
use dot_matrix_sim.charmap.all;
package sim_subprograms is
-- Generate the clock signal
procedure gen_clock(signal clk : inout std_logic);
-- Print message with test OK
procedure print_test_ok;
-- Print a multiline representation of the matrix_type
procedure print_char(constant char : matrix_type);
end package;
package body sim_subprograms is
procedure gen_clock(signal clk : inout std_logic) is
begin
clk <= not clk after clock_period / 2;
end procedure;
procedure print_test_ok is
variable str : line;
begin
write(str, string'("FINAL Test Result: PASSED!"));
writeline(output, str);
end procedure;
procedure print_char(constant char : matrix_type) is
variable str : line;
begin
for row in char'range loop
for col in char(row)'range loop
if char(row)(col) = '1' then
write(str, string'("X"));
else
write(str, string'(" "));
end if;
end loop;
writeline(output, str);
end loop;
end procedure;
end package body;