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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [gaisler/] [can/] [can_mod.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  This program is distributed in the hope that it will be useful,
11
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
--  GNU General Public License for more details.
14
--
15
--  You should have received a copy of the GNU General Public License
16
--  along with this program; if not, write to the Free Software
17
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
18
-----------------------------------------------------------------------------   
19
-- Entity:      can_mod
20
-- File:        can_mod.vhd
21
-- Author:      Jiri Gaisler - Gaisler Research
22
-- Description: OpenCores CAN MAC with FIFO RAM
23
------------------------------------------------------------------------------ 
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library techmap;
28
use techmap.gencomp.all;
29
library opencores;
30
use opencores.cancomp.all;
31
 
32
entity can_mod is
33
   generic (memtech : integer := DEFMEMTECH; syncrst : integer := 0;
34
            ft : integer := 0);
35
   port (
36
      reset  : in  std_logic;
37
      clk     : in  std_logic;
38
      cs      : in  std_logic;
39
      we      : in  std_logic;
40
      addr    : in  std_logic_vector(7 downto 0);
41
      data_in : in  std_logic_vector(7 downto 0);
42
      data_out: out std_logic_vector(7 downto 0);
43
      irq     : out std_logic;
44
      rxi     : in  std_logic;
45
      txo     : out std_logic;
46
      testen  : in  std_logic
47
   );
48
end;
49
 
50
architecture rtl of can_mod is
51
 
52
-- // port connections for Ram
53
--//64x8
54
signal q_dp_64x8        : std_logic_vector(7 downto 0);
55
signal data_64x8        : std_logic_vector(7 downto 0);
56
signal wren_64x8        : std_logic;
57
signal rden_64x8        : std_logic;
58
signal wraddress_64x8   : std_logic_vector(5 downto 0);
59
signal rdaddress_64x8   : std_logic_vector(5 downto 0);
60
--//64x4
61
signal q_dp_64x4        : std_logic_vector(3 downto 0);
62
signal data_64x4        : std_logic_vector(3 downto 0);
63
signal wren_64x4x1      : std_logic;
64
signal wraddress_64x4x1 : std_logic_vector(5 downto 0);
65
signal rdaddress_64x4x1 : std_logic_vector(5 downto 0);
66
--//64x1
67
signal q_dp_64x1        : std_logic_vector(0 downto 0);
68
signal data_64x1        : std_logic_vector(0 downto 0);
69
signal vcc, gnd : std_ulogic;
70
signal testin   : std_logic_vector(3 downto 0);
71
 
72
begin
73
 
74
  gnd <= '0'; vcc <= '1';
75
  testin <= testen & "000";
76
  async : if syncrst = 0 generate
77
    can : can_top port map ( rst => reset, addr => addr, data_in => data_in,
78
        data_out => data_out, cs => cs, we => we, clk_i => clk,
79
        tx_o => txo, rx_i => rxi, bus_off_on => open,  irq_on => irq,
80
        clkout_o => open,
81
        q_dp_64x8 => q_dp_64x8, data_64x8 => data_64x8, wren_64x8 => wren_64x8,
82
        rden_64x8 => rden_64x8, wraddress_64x8 => wraddress_64x8,
83
        rdaddress_64x8 => rdaddress_64x8, q_dp_64x4 => q_dp_64x4,
84
        data_64x4 => data_64x4, wren_64x4x1 => wren_64x4x1,
85
        wraddress_64x4x1 => wraddress_64x4x1,
86
        rdaddress_64x4x1 => rdaddress_64x4x1,
87
        q_dp_64x1 => q_dp_64x1(0), data_64x1 => data_64x1(0));
88
  end generate;
89
 
90
  sync : if syncrst /= 0 generate
91
    can : can_top_sync port map ( rst => reset, addr => addr, data_in => data_in,
92
        data_out => data_out, cs => cs, we => we, clk_i => clk,
93
        tx_o => txo, rx_i => rxi, bus_off_on => open,  irq_on => irq,
94
        clkout_o => open,
95
        q_dp_64x8 => q_dp_64x8, data_64x8 => data_64x8, wren_64x8 => wren_64x8,
96
        rden_64x8 => rden_64x8, wraddress_64x8 => wraddress_64x8,
97
        rdaddress_64x8 => rdaddress_64x8, q_dp_64x4 => q_dp_64x4,
98
        data_64x4 => data_64x4, wren_64x4x1 => wren_64x4x1,
99
        wraddress_64x4x1 => wraddress_64x4x1,
100
        rdaddress_64x4x1 => rdaddress_64x4x1,
101
        q_dp_64x1 => q_dp_64x1(0), data_64x1 => data_64x1(0));
102
  end generate;
103
 
104
  noft : if (ft = 0) or (memtech = 0) generate
105
    fifo : syncram_2p generic map(memtech,6,8,0)
106
    port map(rclk => clk, renable => rden_64x8, wclk => clk,
107
        raddress => rdaddress_64x8, waddress => wraddress_64x8,
108
        datain => data_64x8, write => wren_64x8, dataout => q_dp_64x8,
109
        testin => testin);
110
 
111
    info_fifo : syncram_2p generic map(memtech,6,4,0)
112
    port map(rclk => clk, wclk => clk, raddress => rdaddress_64x4x1,
113
        waddress => wraddress_64x4x1, datain => data_64x4,
114
        write => wren_64x4x1, dataout => q_dp_64x4, renable =>vcc,
115
        testin => testin);
116
 
117
  end generate;
118
 
119
  ften : if not((ft = 0) or (memtech = 0)) generate
120
    fifo : syncram_2pft generic map(memtech,6,8,0,0,2)
121
    port map(rclk => clk, renable => rden_64x8, wclk => clk,
122
        raddress => rdaddress_64x8, waddress => wraddress_64x8,
123
        datain => data_64x8, write => wren_64x8, dataout => q_dp_64x8,
124
        testin => testin);
125
 
126
    info_fifo : syncram_2pft generic map(memtech,6,4,0,0,2)
127
    port map(rclk => clk, wclk => clk, raddress => rdaddress_64x4x1,
128
        waddress => wraddress_64x4x1, datain => data_64x4,
129
        write => wren_64x4x1, dataout => q_dp_64x4, renable =>vcc,
130
        testin => testin);
131
 
132
  end generate;
133
 
134
  overrun_fifo : syncram_2p generic map(0,6,1,0)
135
  port map(rclk => clk, wclk => clk, raddress => rdaddress_64x4x1,
136
        waddress => wraddress_64x4x1, datain => data_64x1,
137
        write  => wren_64x4x1, dataout => q_dp_64x1, renable => vcc,
138
        testin => testin);
139
end;

powered by: WebSVN 2.1.0

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