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

Subversion Repositories risc5x

[/] [risc5x/] [trunk/] [pkg_xilinx_prims.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mikej
--
2
-- Risc5x
3
-- www.OpenCores.Org - November 2001
4
--
5
--
6
-- This library is free software; you can distribute it and/or modify it
7
-- under the terms of the GNU Lesser General Public License as published
8
-- by the Free Software Foundation; either version 2.1 of the License, or
9
-- (at your option) any later version.
10
--
11
-- This library is distributed in the hope that it will be useful, but
12
-- WITHOUT ANY WARRANTY; without even the implied warranty of
13
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
-- See the GNU Lesser General Public License for more details.
15
--
16
-- A RISC CPU core.
17
--
18
-- (c) Mike Johnson 2001. All Rights Reserved.
19
-- mikej@opencores.org for support or any other issues.
20
--
21
-- Revision list
22
--
23
-- version 1.0 initial opencores release
24
--
25
 
26
library ieee;
27
  use ieee.std_logic_1164.all;
28
  use ieee.std_logic_arith.all;
29
  use ieee.std_logic_unsigned.all;
30
 
31
package pkg_xilinx_prims is
32
 
33
  attribute INIT    : string;
34
  attribute INIT_00 : string;
35
  attribute INIT_01 : string;
36
  attribute INIT_02 : string;
37
  attribute INIT_03 : string;
38
  attribute INIT_04 : string;
39
  attribute INIT_05 : string;
40
  attribute INIT_06 : string;
41
  attribute INIT_07 : string;
42
  attribute INIT_08 : string;
43
  attribute INIT_09 : string;
44
  attribute INIT_0A : string;
45
  attribute INIT_0B : string;
46
  attribute INIT_0C : string;
47
  attribute INIT_0D : string;
48
  attribute INIT_0E : string;
49
  attribute INIT_0F : string;
50
 
51
  attribute RLOC   : string;
52
  attribute HU_SET : string;
53
 
54
  function str2slv (str : string) return std_logic_vector;
55
 
56
 
57
  component fd port (
58
      d : in std_logic; c : in std_logic; q : out std_logic );
59
  end component;
60
 
61
  component fde port (
62
      d  : in std_logic; c : in std_logic; ce : in std_logic; q : out std_logic );
63
  end component;
64
 
65
  component fdc port (
66
      d : in std_logic; c : in std_logic; clr : in std_logic; q : out std_logic );
67
  end component;
68
 
69
  component fdce port (
70
      d : in std_logic; c : in std_logic; clr : in std_logic; ce : in std_logic;
71
      q : out std_logic );
72
  end component;
73
 
74
  component fdpe port(
75
      d : in std_logic; c : in std_logic; pre : in std_logic; ce : in std_logic;
76
      q : out std_logic );
77
  end component;
78
 
79
  component ram16x1d
80
    port (
81
      a0, a1, a2, a3 : in std_logic;
82
      dpra0, dpra1, dpra2, dpra3 : in std_logic;
83
      wclk : in std_logic;
84
      we : in std_logic;
85
      d : in std_logic;
86
      spo : out std_logic;
87
      dpo : out std_logic
88
      );
89
  end component;
90
 
91
  component lut4
92
    --pragma translate_off
93
    generic (
94
      INIT : std_logic_vector (15 downto 0)
95
      );
96
    --pragma translate_on
97
    port (
98
      i0 : in std_logic;
99
      i1 : in std_logic;
100
      i2 : in std_logic;
101
      i3 : in std_logic;
102
      O  : out std_logic
103
      );
104
  end component;
105
 
106
  component mult_and
107
     port (
108
        i0 : in std_logic;
109
        i1 : in std_logic;
110
        lo : out std_logic
111
        );
112
  end component;
113
 
114
  component muxcy
115
     port (
116
        di : in std_logic;
117
        ci : in std_logic;
118
        s  : in std_logic;
119
        o  : out std_logic
120
        );
121
  end component;
122
 
123
  component xorcy
124
     port (
125
        li : in std_logic;
126
        ci : in std_logic;
127
        o  : out std_logic
128
        );
129
  end component;
130
 
131
  component muxf6
132
     port (
133
        o  : OUT std_logic;
134
        i0 : IN  std_logic;
135
        i1 : IN  std_logic;
136
        s  : IN  std_logic
137
        );
138
  end component;
139
 
140
  component muxf5
141
     port (
142
        o  : OUT std_logic;
143
        i0 : IN  std_logic;
144
        i1 : IN  std_logic;
145
        s  : IN  std_logic
146
        );
147
  end component;
148
 
149
  component ramb4_s2_s2
150
    --pragma translate_off
151
    generic (
152
      INIT_00 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
153
      INIT_01 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
154
      INIT_02 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
155
      INIT_03 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
156
      INIT_04 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
157
      INIT_05 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
158
      INIT_06 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
159
      INIT_07 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
160
      INIT_08 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
161
      INIT_09 : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
162
      INIT_0A : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
163
      INIT_0B : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
164
      INIT_0C : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
165
      INIT_0D : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
166
      INIT_0E : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000";
167
      INIT_0F : std_logic_vector (255 downto 0) := x"0000000000000000000000000000000000000000000000000000000000000000"
168
      );
169
    --pragma translate_on
170
    port (
171
      dob   : out std_logic_vector (1 downto 0);
172
      dib   : in  std_logic_vector (1 downto 0);
173
      addrb : in  std_logic_vector (10 downto 0);
174
      web   : in  std_logic;
175
      enb   : in  std_logic;
176
      rstb  : in  std_logic;
177
      clkb  : in  std_logic;
178
 
179
      doa   : out std_logic_vector (1 downto 0);
180
      dia   : in  std_logic_vector (1 downto 0);
181
      addra : in  std_logic_vector (10 downto 0);
182
      wea   : in  std_logic;
183
      ena   : in  std_logic;
184
      rsta  : in  std_logic;
185
      clka  : in  std_logic
186
      );
187
  end component;
188
 
189
end;
190
 
191
package body pkg_xilinx_prims is
192
 
193
  function str2slv (str : string) return std_logic_vector is
194
    variable result : std_logic_vector (str'length*4-1 downto 0);
195
  begin
196
    for i in 0 to str'length-1 loop
197
      case str(str'high-i) is
198
        when '0'       => result(i*4+3 downto i*4) := x"0";
199
        when '1'       => result(i*4+3 downto i*4) := x"1";
200
        when '2'       => result(i*4+3 downto i*4) := x"2";
201
        when '3'       => result(i*4+3 downto i*4) := x"3";
202
        when '4'       => result(i*4+3 downto i*4) := x"4";
203
        when '5'       => result(i*4+3 downto i*4) := x"5";
204
        when '6'       => result(i*4+3 downto i*4) := x"6";
205
        when '7'       => result(i*4+3 downto i*4) := x"7";
206
        when '8'       => result(i*4+3 downto i*4) := x"8";
207
        when '9'       => result(i*4+3 downto i*4) := x"9";
208
        when 'a' | 'A' => result(i*4+3 downto i*4) := x"A";
209
        when 'b' | 'B' => result(i*4+3 downto i*4) := x"B";
210
        when 'c' | 'C' => result(i*4+3 downto i*4) := x"C";
211
        when 'd' | 'D' => result(i*4+3 downto i*4) := x"D";
212
        when 'e' | 'E' => result(i*4+3 downto i*4) := x"E";
213
        when 'f' | 'F' => result(i*4+3 downto i*4) := x"F";
214
        when others => result(i*4+3 downto i*4) := "XXXX";
215
      end case;
216
    end loop;
217
 
218
    return result;
219
  end str2slv;
220
 
221
end;

powered by: WebSVN 2.1.0

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