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

Subversion Repositories mcu8

[/] [mcu8/] [trunk/] [src/] [ram_control.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 work.cpu_types.all;
5
 
6
entity ram_control is
7
  port( clk,rst : in std_logic;
8
        input_a : IN d_bus;
9
        input_rom : IN d_bus;
10
        input_ram : in d_bus;
11
        control : in opcode;
12
        ram_data_reg : out d_bus;
13
        addr : OUT d_bus;
14
        data : OUT d_bus;
15
        ce_nwr, ce_nrd : OUT STD_LOGIC );
16
end ram_control;
17
 
18
 
19
architecture behavioral of ram_control is
20 17 dimo
  signal n_clk, p_clk : std_logic;
21 2 dimo
begin
22
  addr <= input_rom;
23
  data <= input_a;
24
 
25 17 dimo
n_sig: process(clk)
26 2 dimo
begin
27 17 dimo
  if clk'event and clk='0' then
28
    if rst='1' then
29
      n_clk <= '0';
30
    else
31
      n_clk <= not n_clk;
32
    end if;
33
  end if;
34
end process;
35
 
36
p_sig: process(clk)
37
begin
38
  if clk'event and clk='1' then
39
      p_clk <= n_clk;
40
  end if;
41
end process;
42
 
43
wr_p: process(p_clk,n_clk,control)
44
begin
45 2 dimo
  if control=sta_1 then
46 17 dimo
    ce_nwr <= not p_clk xor n_clk;
47 2 dimo
  else
48
    ce_nwr <= '1';
49
  end if;
50
end process;
51
 
52
 
53 17 dimo
----rd_p: process(clk,control)
54
----begin
55
----  if control=lda_addr_1 or control=ldb_addr_1 then
56
----    ce_nrd <= clk;
57
----  else
58
----    ce_nrd <= '1';
59
----  end if;
60
----end process;
61 2 dimo
 
62
 
63 17 dimo
rd_p: process(p_clk,n_clk,control)
64 2 dimo
BEGIN
65 7 dimo
  IF control=lda_addr_1 OR control=ldb_addr_1 then
66 17 dimo
    ce_nrd <= not p_clk xor n_clk;
67 7 dimo
  else
68
    ce_nrd <= '1';
69
  end if;
70 2 dimo
END process;
71
 
72
ram_data: process(clk)
73
begin
74
  if clk'event and clk='1' then
75 7 dimo
    if control=lda_addr_1 or control=ldb_addr_1 then
76 2 dimo
      ram_data_reg <= input_ram;
77
    end if;
78
  end if;
79
end process;
80
 
81 17 dimo
----ram_addr: process(clk)
82
----begin
83
----  if clk'event and clk='0' then
84
----    if rst='1' then
85
----      ram_addr_reg <= zero_bus;
86
----    else
87
----      if control=sta_1 then
88
----        ram_addr_reg <= input_rom;
89
----      end if;
90
----   end if;
91
----  end if;
92
----end process;
93 2 dimo
END behavioral;

powered by: WebSVN 2.1.0

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