OpenCores
URL https://opencores.org/ocsvn/npigrctrl/npigrctrl/trunk

Subversion Repositories npigrctrl

[/] [npigrctrl/] [tags/] [arelease/] [npi_vga_v1_00_b/] [hdl/] [vhdl/] [video_cfg.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 slavek
----------------------------------------------------------------------
2
----                                                              ----
3
---- Cfg package                                                  ----
4
----                                                              ----
5
---- Author(s):                                                   ----
6
---- - Slavek Valach, s.valach@dspfpga.com                        ----
7
----                                                              ----
8
----------------------------------------------------------------------
9
----                                                              ----
10
---- Copyright (C) 2008 Authors and OPENCORES.ORG                 ----
11
----                                                              ----
12
---- This source file may be used and distributed without         ----
13
---- restriction provided that this copyright statement is not    ----
14
---- removed from the file and that any derivative work contains  ----
15
---- the original copyright notice and the associated disclaimer. ----
16
----                                                              ----
17
---- This source file is free software; you can redistribute it   ----
18
---- and/or modify it under the terms of the GNU General          ----
19
---- Public License as published by the Free Software Foundation; ----
20
---- either version 2.0 of the License, or (at your option) any   ----
21
---- later version.                                               ----
22
----                                                              ----
23
---- This source is distributed in the hope that it will be       ----
24
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
25
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
26
---- PURPOSE. See the GNU General Public License for more details.----
27
----                                                              ----
28
---- You should have received a copy of the GNU General           ----
29
---- Public License along with this source; if not, download it   ----
30
---- from http://www.gnu.org/licenses/gpl.txt                     ----
31
----                                                              ----
32
----------------------------------------------------------------------
33
 
34
library ieee;
35
use ieee.std_logic_1164.all;
36
use ieee.std_logic_arith.all;
37
 
38
package video_cfg is
39
 
40
type video_params_t is record
41
   x_size         : natural;
42
   y_size         : natural;
43
   pixel_depth    : natural;
44
   h_back_porch   : natural;
45
   h_front_porch  : natural;
46
   h_sync_width   : natural;
47
   h_sync_pol     : std_logic;
48
   v_back_porch   : natural;
49
   v_front_porch  : natural;
50
   v_sync_width   : natural;
51
   v_sync_pol     : std_logic;
52
end record;
53
 
54
function log2(x : natural) return integer;
55
function get_NPI_Size(constant C_NPI_DATA_WIDTH : natural; constant C_NPI_BURST_SIZE : natural) return std_logic_vector;
56
 
57
end video_cfg;
58
 
59
package body video_cfg is
60
 
61
function log2(x : natural) return integer is
62
   variable i  : integer := 0;
63
begin
64
   if x = 0 then
65
      return 0;
66
   else
67
      while 2**i < x loop
68
         i := i+1;
69
      end loop;
70
      return i;
71
   end if;
72
end function log2;
73
 
74
function get_NPI_Size(constant C_NPI_DATA_WIDTH : natural; constant C_NPI_BURST_SIZE : natural) return std_logic_vector is
75
BEGIN
76
   Case C_NPI_BURST_SIZE is
77
      When 4 =>
78
         If C_NPI_DATA_WIDTH = 64 Then
79
         ASSERT FALSE
80
            REPORT "4 byte NPI Burst size is not supported for 64bit interface!"
81
            SEVERITY ERROR;
82
            return x"F";
83
         Else
84
            return x"0";
85
         End If;
86
 
87
      When 8 =>
88
         If C_NPI_DATA_WIDTH = 64 Then
89
            return x"0";
90
         Else
91
            REPORT "8 byte NPI Burst size is not supported for 32bit interface!"
92
            SEVERITY ERROR;
93
            return x"F";
94
         End If;
95
 
96
      When 16 =>
97
         If C_NPI_DATA_WIDTH = 64 Then
98
            return x"1";
99
         Else
100
            return x"1";
101
         End If;
102
 
103
      When 32 =>
104
         If C_NPI_DATA_WIDTH = 64 Then
105
            return x"2";
106
         Else
107
            return x"2";
108
         End If;
109
 
110
      When 64 =>
111
         If C_NPI_DATA_WIDTH = 64 Then
112
            return x"3";
113
         Else
114
            return x"3";
115
         End If;
116
 
117
      When 128 =>
118
         If C_NPI_DATA_WIDTH = 64 Then
119
            return x"4";
120
         Else
121
            return x"4";
122
         End If;
123
      When 256 =>
124
         If C_NPI_DATA_WIDTH = 64 Then
125
            return x"5";
126
         Else
127
            ASSERT FALSE
128
               REPORT "NPI Burst size is not supported!"
129
               SEVERITY ERROR;
130
            return x"F";
131
         End If;
132
 
133
      When Others =>
134
         ASSERT FALSE
135
            REPORT "NPI Burst size is not supported!"
136
            SEVERITY ERROR;
137
         return x"F";
138
   End Case;
139
END FUNCTION get_NPI_Size;
140
 
141
end video_cfg;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.