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

Subversion Repositories mcu8

[/] [mcu8/] [trunk/] [src/] [rom.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimo
LIBRARY ieee;
2
USE ieee.std_logic_1164.ALL;
3
USE ieee.numeric_std.ALL;
4
USE std.textio.ALL;
5
USE work.cpu_types.ALL;
6
 
7
ENTITY rom IS
8
  GENERIC ( tacc : time := 120 NS );        -- address to data valid
9
  port( addr : IN a_bus;
10
        data : out d_bus );
11
END rom;
12
 
13
ARCHITECTURE behavioral OF rom IS
14
  SIGNAL memory : rom_memory;
15
BEGIN
16
rom_read: process(addr, memory)
17
  begin
18 17 dimo
    data <= (OTHERS => 'X'), memory(to_integer(unsigned(addr))) AFTER tacc;
19
--    data <= memory(to_integer(unsigned(addr))) AFTER tacc;
20 2 dimo
  END process;
21
 
22
rom_init: process
23 19 dimo
    FILE src_file : TEXT IS IN "fulltest.o";
24 2 dimo
    VARIABLE src_line : LINE;
25
    VARIABLE data : INTEGER RANGE 0 TO 2**d_bus_width-1;
26
    VARIABLE index : INTEGER RANGE 0 TO 2**a_bus_width-1 := 0;
27
  BEGIN
28
    WHILE NOT endfile(src_file) LOOP
29
      readline(src_file, src_line);
30
      read(src_line, data);
31
      memory(index) <= std_logic_vector(to_unsigned(data,8));
32 17 dimo
      if index<255 then
33 2 dimo
      index := index + 1;
34 17 dimo
      end if;
35 2 dimo
    END LOOP;
36
    wait;
37
  END process;
38
END behavioral;

powered by: WebSVN 2.1.0

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