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

Subversion Repositories spi_boot

[/] [spi_boot/] [trunk/] [rtl/] [vhdl/] [chip-sd-a.vhd] - Blame information for rev 35

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 arniml
-------------------------------------------------------------------------------
2
--
3
-- SD/MMC Bootloader
4
-- Chip toplevel design with SD feature set
5
--
6 35 arniml
-- $Id: chip-sd-a.vhd,v 1.4 2005-03-08 22:07:12 arniml Exp $
7 3 arniml
--
8
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org)
9
--
10
-- All rights reserved, see COPYING.
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/projects.cgi/web/spi_boot/overview
44
--
45
-------------------------------------------------------------------------------
46
 
47
library ieee;
48
use ieee.std_logic_1164.all;
49
 
50
 
51
architecture sd of chip is
52
 
53
  component spi_boot
54
    generic (
55 35 arniml
      width_set_sel_g      : integer := 4;
56 3 arniml
      width_bit_cnt_g      : integer := 6;
57 17 arniml
      width_img_cnt_g      : integer := 2;
58
      num_bits_per_img_g   : integer := 18;
59 3 arniml
      sd_init_g            : integer := 0;
60
      mmc_compat_clk_div_g : integer := 0;
61
      width_mmc_clk_div_g  : integer := 0;
62
      reset_level_g        : integer := 0
63
    );
64
    port (
65
      clk_i          : in  std_logic;
66
      reset_i        : in  std_logic;
67 35 arniml
      set_sel_n_i    : in  std_logic_vector(width_set_sel_g-1 downto 0);
68 3 arniml
      spi_clk_o      : out std_logic;
69
      spi_cs_n_o     : out std_logic;
70
      spi_data_in_i  : in  std_logic;
71
      spi_data_out_o : out std_logic;
72 12 arniml
      spi_en_outs_o  : out std_logic;
73 3 arniml
      start_i        : in  std_logic;
74
      mode_i         : in  std_logic;
75
      config_n_o     : out std_logic;
76
      cfg_init_n_i   : in  std_logic;
77
      cfg_done_i     : in  std_logic;
78
      dat_done_i     : in  std_logic;
79
      cfg_clk_o      : out std_logic;
80
      cfg_dat_o      : out std_logic
81
    );
82
  end component;
83
 
84 12 arniml
  signal spi_clk_s      : std_logic;
85
  signal spi_cs_n_s     : std_logic;
86
  signal spi_data_out_s : std_logic;
87
  signal spi_en_outs_s  : std_logic;
88
 
89 3 arniml
begin
90
 
91
  spi_boot_b : spi_boot
92
    generic map (
93 35 arniml
      width_set_sel_g      => 4,        -- 16 sets
94 3 arniml
      width_bit_cnt_g      => 12,       -- 512 bytes per block
95 17 arniml
      width_img_cnt_g      => 2,        -- 4 images
96
      num_bits_per_img_g   => 18,       -- 256 kByte per image
97 3 arniml
      sd_init_g            => 1,        -- SD specific initialization
98
      mmc_compat_clk_div_g => 0,        -- no MMC compatibility
99
      width_mmc_clk_div_g  => 0         -- no MMC compatibility
100
    )
101
    port map (
102
      clk_i                => clk_i,
103
      reset_i              => reset_i,
104 35 arniml
      set_sel_n_i          => set_sel_n_i,
105 12 arniml
      spi_clk_o            => spi_clk_s,
106
      spi_cs_n_o           => spi_cs_n_s,
107 3 arniml
      spi_data_in_i        => spi_data_in_i,
108 12 arniml
      spi_data_out_o       => spi_data_out_s,
109
      spi_en_outs_o        => spi_en_outs_s,
110 3 arniml
      start_i              => start_i,
111
      mode_i               => mode_i,
112
      config_n_o           => config_n_o,
113
      cfg_init_n_i         => cfg_init_n_i,
114
      cfg_done_i           => cfg_done_i,
115
      dat_done_i           => dat_done_i,
116
      cfg_clk_o            => cfg_clk_o,
117
      cfg_dat_o            => cfg_dat_o
118
    );
119
 
120 12 arniml
  -----------------------------------------------------------------------------
121
  -- Three state drivers for SPI outputs.
122
  -----------------------------------------------------------------------------
123
  spi_clk_o      <=   spi_clk_s
124
                    when spi_en_outs_s = '1' else
125
                      'Z';
126
  spi_cs_n_o     <=   spi_cs_n_s
127
                    when spi_en_outs_s = '1' else
128
                      'Z';
129
  spi_data_out_o <=   spi_data_out_s
130
                    when spi_en_outs_s = '1' else
131
                      'Z';
132
 
133 3 arniml
end sd;
134
 
135
 
136
-------------------------------------------------------------------------------
137
-- File History:
138
--
139
-- $Log: not supported by cvs2svn $
140 35 arniml
-- Revision 1.3  2005/02/18 06:42:14  arniml
141
-- clarify wording for images
142
--
143 17 arniml
-- Revision 1.2  2005/02/16 18:54:39  arniml
144
-- added tri-state drivers for spi outputs
145
--
146 12 arniml
-- Revision 1.1  2005/02/08 20:41:32  arniml
147
-- initial check-in
148
--
149 3 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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