-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommonPak.vhd
More file actions
80 lines (54 loc) · 2.08 KB
/
commonPak.vhd
File metadata and controls
80 lines (54 loc) · 2.08 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
-- Original Source from FP-V-GA-Text: https://github.com/MadLittleMods/FP-V-GA-Text
--
-- Package File Template
--
-- Purpose: This package defines supplemental types, subtypes,
-- constants, and functions
--
-- To use any of the example code shown below, uncomment the lines and modify as necessary
--
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.math_real.all;
package commonPak is
constant ADDR_WIDTH : integer := 11;
constant DATA_WIDTH : integer := 8;
constant FONT_WIDTH : integer := 8;
constant FONT_HEIGHT : integer := 16;
------------------------------------------
type type_textColorMap is array(natural range <>) of std_logic_vector(7 downto 0);
------------------------------------------
type type_drawElement is
record
pixelOn: boolean;
rgb: std_logic_vector(7 downto 0);
end record;
constant init_type_drawElement: type_drawElement := (pixelOn => false, rgb => (others => '0'));
type type_drawElementArray is array(natural range <>) of type_drawElement;
------------------------------------------
type type_inArbiterPort is
record
dataRequest: boolean;
addr: std_logic_vector(ADDR_WIDTH-1 downto 0);
writeRequest: boolean;
writeData: std_logic_vector(DATA_WIDTH-1 downto 0);
end record;
constant init_type_inArbiterPort: type_inArbiterPort := (dataRequest => false, addr => (others => '0'), writeRequest => false, writeData => (others => '0'));
type type_inArbiterPortArray is array(natural range <>) of type_inArbiterPort;
type type_outArbiterPort is
record
dataWaiting: boolean;
data: std_logic_vector(DATA_WIDTH-1 downto 0);
dataWritten: boolean;
end record;
constant init_type_outArbiterPort: type_outArbiterPort := (dataWaiting => false, data => (others => '0'), dataWritten => false);
type type_outArbiterPortArray is array(natural range <>) of type_outArbiterPort;
----------------------
function log2_float(val : positive) return natural;
end commonPak;
package body commonPak is
function log2_float(val : positive) return natural is
begin
return integer(ceil(log2(real(val))));
end function;
end commonPak;