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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [uCtrl/] [test_rom.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY ieee;
21
USE ieee.std_logic_1164.ALL;
22
USE ieee.numeric_std.ALL;
23
-- USE work.rom_parts.ALL;
24
 
25
ENTITY test_rom IS
26
 
27
  PORT (
28
    clk : IN  STD_LOGIC;
29
    rst : IN  STD_LOGIC;
30
    led : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
31
 
32
END test_rom;
33
 
34
--ARCHITECTURE Behavioral OF test_rom IS
35
 
36
--  SIGNAL address : STD_LOGIC_VECTOR(5 DOWNTO 0);
37
 
38
--BEGIN  -- Behavioral
39
 
40
--  ROM1 : rom_in_pr
41
--    GENERIC MAP (
42
--      w_data => 8,
43
--      w_addr => 6)
44
--    PORT MAP (
45
--      clk => clk,
46
--      a1  => address,
47
--      q1  => led);
48
 
49
--  -- purpose: Count up
50
--  -- type   : sequential
51
--  -- inputs : clk, rst
52
--  -- outputs: address
53
--  CTR : PROCESS (clk, rst)
54
--    VARIABLE cval : NATURAL := 0;
55
--  BEGIN  -- PROCESS CTR
56
--    IF rising_edge(clk) THEN
57
--      IF rst = '1' THEN
58
--        address <= STD_LOGIC_VECTOR(to_unsigned(0, 6));
59
--      ELSE
60
--        cval := to_integer(UNSIGNED(address));
61
 
62
--        IF cval = 63 THEN
63
--          cval := 0;
64
--        ELSE
65
--          cval := cval + 1;
66
--        END IF;
67
 
68
--        address <= STD_LOGIC_VECTOR(to_unsigned(cval, 6));
69
--      END IF;
70
--    END IF;
71
--  END PROCESS CTR;
72
 
73
--END Behavioral;
74
 
75
--ARCHITECTURE Behavioral OF test_rom IS
76
 
77
--  SIGNAL address : STD_LOGIC_VECTOR(5 DOWNTO 0);
78
 
79
--BEGIN  -- Behavioral
80
 
81
--  ROM1 : rom_out_pr
82
--    GENERIC MAP (
83
--      w_data => 8,
84
--      w_addr => 6)
85
--    PORT MAP (
86
--      clk => clk,
87
--      a1  => address,
88
--      q1  => led);
89
 
90
--  -- purpose: Count up
91
--  -- type   : sequential
92
--  -- inputs : clk, rst
93
--  -- outputs: address
94
--  CTR : PROCESS (clk, rst)
95
--    VARIABLE cval : NATURAL := 0;
96
--  BEGIN  -- PROCESS CTR
97
--    IF rising_edge(clk) THEN
98
--      IF rst = '1' THEN
99
--        address <= STD_LOGIC_VECTOR(to_unsigned(0, 6));
100
--      ELSE
101
--        cval := to_integer(UNSIGNED(address));
102
 
103
--        IF cval = 63 THEN
104
--          cval := 0;
105
--        ELSE
106
--          cval := cval + 1;
107
--        END IF;
108
 
109
--        address <= STD_LOGIC_VECTOR(to_unsigned(cval, 6));
110
--      END IF;
111
--    END IF;
112
--  END PROCESS CTR;
113
 
114
--END Behavioral;
115
 
116
--ARCHITECTURE Behavioral OF test_rom IS
117
 
118
--  SIGNAL address   : STD_LOGIC_VECTOR(5 DOWNTO 0);
119
--  SIGNAL increment : STD_LOGIC_VECTOR(5 DOWNTO 0);
120
 
121
--BEGIN  -- Behavioral
122
 
123
--  ROM1 : rom_db_pr
124
--    GENERIC MAP (
125
--      w_data => 8,
126
--      w_addr => 6)
127
--    PORT MAP (
128
--      clk => clk,
129
--      a1  => address,
130
--      q1  => led);
131
 
132
--  -- purpose: Count up
133
--  -- type   : sequential
134
--  -- inputs : clk, rst
135
--  -- outputs: address
136
--  CTR : PROCESS (clk, rst)
137
--    VARIABLE cval : NATURAL := 0;
138
--  BEGIN  -- PROCESS CTR
139
--    IF rising_edge(clk) THEN
140
--      IF rst = '1' THEN
141
--        address <= "000000";
142
--      ELSE
143
--        address <= increment;
144
--      END IF;
145
--    END IF;
146
--  END PROCESS CTR;
147
 
148
--  -- purpose: Increment the ingoing value
149
--  -- type   : combinational
150
--  -- inputs : address
151
--  -- outputs: increment
152
--  INC1: PROCESS (address)
153
--  BEGIN  -- PROCESS INC1
154
--    increment <= STD_LOGIC_VECTOR(UNSIGNED(address) + to_unsigned(1, 6));
155
--  END PROCESS INC1;
156
 
157
--END Behavioral;
158
 
159
ARCHITECTURE Behavioral OF test_rom IS
160
 
161
  SIGNAL ctr   : NATURAL RANGE 0 TO 255 := 0;
162
  SIGNAL out_v : STD_LOGIC_VECTOR(7 DOWNTO 0);
163
 
164
BEGIN  -- Behavioral
165
 
166
  CTR1 : PROCESS (clk, rst)
167
  BEGIN  -- PROCESS CTR1
168
    IF rising_edge(clk) THEN
169
      IF rst = '1' THEN                 -- asynchronous reset (active low)
170
        ctr <= 0;
171
      ELSE
172
 
173
        IF ctr = 255 THEN
174
          ctr <= 0;
175
        ELSE
176
          ctr <= ctr + 1;
177
        END IF;
178
      END IF;
179
    END IF;
180
  END PROCESS CTR1;
181
 
182
  --LOOKUP1 : PROCESS (clk, rst)
183
  --BEGIN  -- PROCESS LOOKUP1
184
  --  IF rising_edge(clk) THEN
185
  --    IF rst = '1' THEN                 -- asynchronous reset (active low)
186
  --      out_v <= "00000000";
187
  --    ELSE
188
 
189
  --      CASE ctr IS
190
  --        WHEN 0 =>
191
  --          out_v <= "00000000";
192
  --        WHEN 1 =>
193
  --          out_v <= "00000001";
194
  --        WHEN 2 =>
195
  --          out_v <= "00000010";
196
  --        WHEN 3 =>
197
  --          out_v <= "00000100";
198
  --        WHEN 4 =>
199
  --          out_v <= "00001000";
200
  --        WHEN 5 =>
201
  --          out_v <= "00010000";
202
  --        WHEN 6 =>
203
  --          out_v <= "00100000";
204
  --        WHEN 7 =>
205
  --          out_v <= "01000000";
206
  --        WHEN 8 =>
207
  --          out_v <= "10000000";
208
  --        WHEN OTHERS =>
209
  --          out_v <= "11111111";
210
  --      END CASE;
211
 
212
  --    END IF;
213
  --  END IF;
214
  --END PROCESS LOOKUP1;
215
 
216
  --led <= out_v;
217
 
218
  led <= STD_LOGIC_VECTOR(to_unsigned(ctr, 8));
219
 
220
END Behavioral;

powered by: WebSVN 2.1.0

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