]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/bus_bcd.vhd
FPGA: IRC - dff sampler shouldn't have reset
[fpga/lx-cpu1/lx-rocon.git] / hw / bus_bcd.vhd
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.all;
4 use ieee.std_logic_unsigned.all;
5 use ieee.numeric_std.all;
6
7 -- BCD interconnection
8
9 entity bus_bcd is
10         port
11         (
12                 -- Reset
13                 reset      : in std_logic;
14
15                 -- Enable
16                 en         : in std_logic;
17
18                 -- Clock
19                 clk        : in std_logic;
20
21                 -- Chip enable
22                 ce         : in std_logic;
23
24                 -- Data bus (read only)
25                 data_out   : out std_logic_vector(31 downto 0);
26
27                 -- Bus signals
28                 rd         : in std_logic;
29                 ta         : out std_logic
30         );
31 end bus_bcd;
32
33 architecture Behavioral of bus_bcd is
34
35         signal value : std_logic_vector(31 downto 0);
36
37         component bcd
38         generic
39         (
40                 width      : integer
41         );
42         port
43         (
44                 reset      : in std_logic;
45                 en         : in std_logic;
46                 clk        : in std_logic;
47                 value      : out std_logic_vector((width-1) downto 0)
48         );
49         end component;
50
51 begin
52
53         my_bcd: bcd
54         generic map
55         (
56                 width => 32
57         )
58         port map
59         (
60                 reset => reset,
61                 en => en,
62                 clk => clk,
63                 value => value
64         );
65
66         memory_bus: process(ce, rd, value)
67         begin
68
69                 -- Init defaults
70                 ta <= '1';
71                 data_out <= (others => 'X');
72
73                 if ce = '0' and rd = '0' then
74                         ta <= '0';
75                         -- ID in big endian
76                         data_out <= value;
77                 end if;
78
79         end process;
80
81
82 end Behavioral;
83