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

Subversion Repositories sd_card_controller

[/] [sd_card_controller/] [trunk/] [doc/] [src/] [usage.tex] - Blame information for rev 5

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

Line No. Rev Author Line
1 3 rozpruwacz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
%%%%                                                              %%%%
3
%%%% WISHBONE SD Card Controller IP Core                          %%%%
4
%%%%                                                              %%%%
5
%%%% usage.tex                                                    %%%%
6
%%%%                                                              %%%%
7
%%%% This file is part of the WISHBONE SD Card                    %%%%
8
%%%% Controller IP Core project                                   %%%%
9
%%%% http://www.opencores.org/cores/xxx/                          %%%%
10
%%%%                                                              %%%%
11
%%%% Description                                                  %%%%
12
%%%% documentation 'Usage' chapter                                %%%%
13
%%%%                                                              %%%%
14
%%%% Author(s):                                                   %%%%
15
%%%%     - Marek Czerski, ma.czerski@gmail.com                    %%%%
16
%%%%                                                              %%%%
17
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
%%%%                                                              %%%%
19
%%%% Copyright (C) 2013 Authors                                   %%%%
20
%%%%                                                              %%%%
21
%%%% This source file may be used and distributed without         %%%%
22
%%%% restriction provided that this copyright statement is not    %%%%
23
%%%% removed from the file and that any derivative work contains  %%%%
24
%%%% the original copyright notice and the associated disclaimer. %%%%
25
%%%%                                                              %%%%
26
%%%% This source file is free software; you can redistribute it   %%%%
27
%%%% and/or modify it under the terms of the GNU Lesser General   %%%%
28
%%%% Public License as published by the Free Software Foundation; %%%%
29
%%%% either version 2.1 of the License, or (at your option) any   %%%%
30
%%%% later version.                                               %%%%
31
%%%%                                                              %%%%
32
%%%% This source is distributed in the hope that it will be       %%%%
33
%%%% useful, but WITHOUT ANY WARRANTY; without even the implied   %%%%
34
%%%% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      %%%%
35
%%%% PURPOSE. See the GNU Lesser General Public License for more  %%%%
36
%%%% details.                                                     %%%%
37
%%%%                                                              %%%%
38
%%%% You should have received a copy of the GNU Lesser General    %%%%
39
%%%% Public License along with this source; if not, download it   %%%%
40
%%%% from http://www.opencores.org/lgpl.shtml                     %%%%
41
%%%%                                                              %%%%
42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43
\section{Usage}
44
\label{chap:usage}
45
 
46
    This chapter describes usage of the IP core.
47
 
48
    \subsection{Directory structure}
49
    \label{sec:dir_struct}
50
 
51
    \textit{Wishbone SD Card Controller IP Core} comes with following directory structure:
52
 
53
    \dirtree{%
54
        .1 ..
55
        .2 bench.
56
        .3 verilog.
57
        .2 doc.
58
        .3 references.
59
        .3 src.
60
        .2 rtl.
61
        .3 verilog.
62
        .2 sim.
63
        .3 rtl\_sim.
64
        .4 bin.
65
        .4 log.
66
        .4 run.
67
        .2 sw.
68
        .3 example.
69
        .2 syn.
70
        .3 quartus.
71
        .4 bin.
72
        .4 run.
73
        .4 src.
74
    }
75
 
76
    \begin{description}
77
    \item[\texttt{bench/verilog}] - verilog testbench sources,
78
    \item[\texttt{doc}] - documentation files,
79
    \item[\texttt{doc/src}] - documentation \LaTeX sources,
80
    \item[\texttt{rtl/verilog}] - ip core verilog sources,
81
    \item[\texttt{sim/rtl\_sim/bin}] - simulation makefile and modelsim scripts,
82
    \item[\texttt{sim/rtl\_sim/log}] - log files created during simulation,
83
    \item[\texttt{sim/rtl\_sim/run}] - simulation execution directory,
84
    \item[\texttt{sw/example}] - baremetal example application for or1k,
85
    \item[\texttt{syn/quartus/bin}] - synthesis makefile and scripts for quartus example project,
86
    \item[\texttt{syn/quartus/run}] - synthesis execution directory,
87
    \item[\texttt{syn/quartus/src}] - example project sources.
88
    \end{description}
89
 
90
    \subsection{Simulation}
91
    \label{sec:simulation}
92
 
93
    To start simulation just enter to \path{sim/rtl_sim/run} directory and type \texttt{make}:
94
    \begin{verbatim}
95
#> cd sim/rtl_sim/run
96
#> make
97
    \end{verbatim}
98
 
99
    Every testbench is written in SystemVerilog (mostly due to use of \texttt{assert} keyword). Every testbench is self checking. Test error are represented by
100
    assert failures. Every testbench starts by displaying:
101
    \begin{verbatim}
102
# testbench_name start ...
103
    \end{verbatim}
104
    and ends by displaying:
105
    \begin{verbatim}
106
# testbench_name finish ...
107
    \end{verbatim}
108
    If no asserts are displayed between these lines, the test passes. Below is an example of passing test:
109
    \begin{verbatim}
110
...
111
some compilation output
112
...
113
# sd_cmd_master_tb start ...
114
# sd_cmd_master_tb finish ...
115
# ** Note: $finish    : ../../../bench/verilog/sd_cmd_master_tb.sv(385)
116
#    Time: 3620 ps  Iteration: 0  Instance: /sd_cmd_master_tb
117
    \end{verbatim}
118
    Below is an example of failing test:
119
    \begin{verbatim}
120
...
121
some compilation output
122
...
123
# sd_cmd_master_tb start ...
124
# ** Error: Assertion error.
125
#    Time: 3280 ps  Scope: sd_cmd_master_tb File: ../../../bench/verilog/
126
                                                    sd_cmd_master_tb.sv Line: 376
127
# sd_cmd_master_tb finish ...
128
# ** Note: $finish    : ../../../bench/verilog/sd_cmd_master_tb.sv(385)
129
#    Time: 3620 ps  Iteration: 0  Instance: /sd_cmd_master_tb
130
    \end{verbatim}
131
 
132
    \subsubsection{Simulation makefile targets}
133
    \label{sec:sim_make_targ}
134
 
135
    The default simulation target is to run all testbenches from \path{bench/verilog} directory that ends with \path{_.sv}. Other simulation targets are:
136
    \begin{description}
137
    \item[\texttt{clean}] - remove all simulation output files,
138
    \item[\texttt{print\_testbenches}] - lists all availible testbenches,
139
    \item[\texttt{modelsim}] - compiles all sources and launches modelsim (see \ref{sec:sim_make_var}),
140
    \item[\texttt{*\_tb}] - compiles and executes given testbench. All items listed by the \path{print_testbenches} target can be executed this way,
141
    \item[\texttt{*\_tb\_gui}] - same as \path{*_tb} target, only instead of executing simulation in command-line, launches modelsim.
142
    \end{description}
143
 
144
    \subsubsection{Simulation makefile environment variables}
145
    \label{sec:sim_make_var}
146
 
147
    Simulation makefile uses couple of environment variables to setup simulation:
148
    \begin{description}
149
    \item[\texttt{MODELSIM\_DIR}] - modelsim installation directory (\path{\$(MODELSIM_DIR)/bin/vsim} should be a valid path),
150
    \item[\texttt{VCD}] - when set to 1 - all waveforms are dumped to \path{sim/rtl_sim/out/*.vcd} files; when set to 0 - no waveforms are dumped (0 is default),
151
    \item[\texttt{V}] - when set to 1 - enables verbose output; when set to 0 - normal simulation output (0 is default).
152
    \end{description}
153
 
154
 
155
    \subsection{Synthesis}
156
    \label{sec:synthesis}
157
 
158
    For the purpose of synthesis verification there is an example FPGA project made for Altera Quartus.
159
    To start synthesis just enter to \path{syn/quartus/run} directory and type \texttt{make}:
160
    \begin{verbatim}
161
#> cd syn/quartus/run
162
#> make
163
    \end{verbatim}
164
    Example project consist of all verilog sources from \path{rtl/verilog} directory and \path{syn/quartus/src/sdc_controller_top.v} source file.
165
    The purpose of the additional verilog file is to instantiate the \textit{Wishbone SD Card Controller IP Core} and register all inputs/outputs to/from the core.
166
    This makes timing verification more accurate.
167
 
168
    \subsubsection{Synthesis makefile targets}
169
    \label{sec:syn_make_targ}
170
 
171
    The default synthesis target is to synthesize the project and create .sof file in \path{syn/quartus/run} directory. Other synthesis targets are:
172
    \begin{description}
173
    \item[\texttt{clean}] - remove all synthesis output files,
174
    \item[\texttt{print\_config}] - prints projects configuration of FPGA device,
175
    \item[\texttt{project}] - creates quartus project files (.qpf and .qsf),
176
    \item[\texttt{quartus}] - creates quartus project files and launches quartus IDE.
177
    \end{description}
178
 
179
    \subsubsection{Synthesis makefile environment variables}
180
    \label{sec:syn_make_var}
181
 
182
    Synthesis makefile uses couple of environment variables to setup synthesis:
183
    \begin{description}
184
    \item[\texttt{QUARTUS\_DIR}] - quartus installation directory (\path{\$(QUARTUS_DIR)/bin/quartus} should be a valid path),
185
    \item[\texttt{FPGA\_FAMILY}] - name of the FPGA device family,
186
    \item[\texttt{FPGA\_PART}] - name of the FPGA device,
187
    \item[\texttt{V}] - when set to 1 - enables verbose output; when set to 0 - normal simulation output (0 is default).
188
    \end{description}
189
 

powered by: WebSVN 2.1.0

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