c The CRC Compiler is scheduled for product obsolescence and discontinued
support as described in PDN1304. Therefore, Altera does not recommend use
of this IP in new designs. For more information about Altera’s current IP
offering, refer to Altera’s Intellectual Property website.
The CRC Compiler generates high-performance circuits to generate or check Cyclic
Redundancy Check (CRC) checksums for packet-based communication.
The CRC generator uses an Avalon-ST
interface to receive data and emits generated
checksums on a dedicated output. The CRC checker similarly uses an Avalon-ST
interface to receive a packet with a CRC checksum and uses a dedicated output to
indicate if the checksum is correct. The CRC generator and checker MegaCore
functions do not store any data, checksums, or status.
CRC MegaCore Function Verification
Before releasing the CRC Compiler, Altera runs comprehensive regression tests to
verify the quality and correctness of the CRC Compiler.
Custom variations generated by the CRC Compiler exercise the CRC compiler’s
various parameter options. The resulting simulation models are thoroughly
simulated, and the results are verified against bit-accurate master simulation models.
Performance and Resource Utilization
Parameterization allows you to generate the most efficient implementation that meets
your design functionality, size, and performance goals.
The section lists the performance and resource utilization for several sample
implementations in different device families. The performance metrics were
generated using the Quartus
analyzer, with the fastest speed grade selected for the device family. Neither the
generator nor checker MegaCore function uses any memory.
Tab le 1– 3 shows the typical expected performance and resource utilization for
Cyclone II, Cyclone III, and Stratix GX devices.
Table 1–3. Performance and Resource Utilization for Cyclone II, Cyclone III and Stratix GX
Device and
Speed Grade
Cyclone II
-6
Cyclone III
-6
Stratix GX
-5
Note to Table 1–3:
(1) Parameters set to their default values are not mentioned.
Tab le 1– 4 shows the typical expected performance for Stratix II, Stratix II GX, and
Stratix III devices. The performance of the MegaCore function in Stratix IV devices is
similar to Stratix III devices.
Table 1–4. Performance and Resource Utilization Stratix II, Stratix II GX and Stratix III Devices
Device and
Speed Grade
Stratix II
-3
MegaCore
FunctionParameter Settings (1)ALUTs
CRC generator 32-bit datapath
CRC-32
4 symbols per word
Optimize for speed
Stratix II
-3
CRC generator 32-bit datapath
CRC-32
4 symbols per word
Optimize for speed
8 channels
Stratix II GX
-3
CRC checker64-bit datapath
8 symbols per word CRC16-CCITT
Optimize for speed
Stratix II GX
-3
CRC checker64-bit datapath
8 symbols per word CRC16-CCITT
Optimize for speed
8 channels
Stratix III
-2
CRC generator 32-bit datapath
CRC-32
4 symbols per word
Optimize for speed
Note to Table 1–4:
(1) Parameters set to their default values are not mentioned.
Logic
Registers
f
max
MHz
Throughput
Gbps
5103732748.7
8691177226.967.3
55135824115.4
440614201.912.9
51937233010.5
Installation and Licensing
The CRC Compiler is part of the MegaCore® IP Library, which is distributed with the
Quartus
fFor system requirements and installation instructions, refer to Quartus II Installation &
Licensing for Windows and Linux Workstations.
Figure 1–1 shows the directory structure after you install the CRC Compiler User
Guide Compiler, where <path> is the installation directory. The default installation
directory on Windows is c:\altera\<version>; on UNIX and Solaris it is /opt/altera/<version>.
■ Verify the functionality of your design, as well as evaluate its size and speed
quickly and easily.
■ Generate time-limited device programming files for designs that include
megafunctions.
■ Program a device and verify your design in hardware.
You only need to purchase a license for the megafunction when you are completely
satisfied with its functionality and performance, and want to take your design to
production.
After you purchase a license for CRC Compiler MegaCore function, you can request a
license file from the Altera website at www.altera.com/licensing and install it on your
computer. When you request a license file, Altera emails you a license.dat file. If you
do not have Internet access, contact your local Altera representative.
fFor more information on OpenCore Plus hardware evaluation, refer to AN 320:
OpenCore Plus Evaluation of Megafunctions.
OpenCoree Plus hardware evaluation supports the following two operation modes:
■ Untethered—the design runs for a limited time.
■ Tethered—requires a connection between your board and the host computer. If
tethered mode is supported by all megafunctions in a design, the device can
operate for a longer time or indefinitely.
Preliminary
1–6Chapter 1: About This Compiler
Installation and Licensing
All megafunctions in a device time out simultaneously when the most restrictive
evaluation time is reached. If there is more than one megafunction in a design, a
specific megafunction’s time-out behavior may be masked by the time-out behavior of
the other megafunctions.
1For MegaCore functions, the untethered timeout is 1 hour; the tethered timeout value
is indefinite.
Your design stops working after the evaluation time expires; the checksum output
signal in a generator and the crcbad output signal in a checker are forced low.
fFor more information on IP functional simulation models, refer to the Simulating
2. Getting Started
To evaluate the CRC compiler using the OpenCore Plus feature include these steps in
your design flow:
1. Obtain and install the CRC compiler.
2. Create a custom variation of the CRC compiler.
3. Implement the rest of your design using the design entry method of your choice.
4. Use the IP functional simulation model to verify the operation of your design.
Altera IP in Third-Party Simulation Tools chapter in volume 3 of the Quartus II
Handbook.
5. Use the Quartus II software to compile your design.
1You also can generate an OpenCore Plus time-limited programming file,
which you can use to verify the operation of your design in hardware.
6. Purchase a license for the CRC compiler.
After you have purchased a license for the CRC compiler, follow these additional
steps:
1. Set up licensing.
2. Generate a programming file for the Altera
3. Program the Altera device(s) with the completed design.
CRC Compiler Walkthrough
This walkthrough explains how to create a CRC compiler MegaCore function
variation using the Quartus II MegaWizard
generating your custom variation, you can incorporate it into your overall project.
You need to create a new Quartus II project with the New Project Wizard, which
specifies the working directory for the project, assigns the project name, and
designates the name of the top-level design entity.
To create a new project, follow these steps:
1. Choose Programs >Altera > Quartus II <version> (Windows Start menu) to run
the Quartus II software. Alternatively, you can use the Quartus II Web Edition
software.
2. Choose New Project Wizard (File menu).
3. Click Next in the New Project Wizard Introduction page (the introduction page
does not display if you turned it off previously).
4. In the New Project Wizard: Directory, Name, Top-Level Entity page, enter the
following information:
a. Specify the working directory for your project. For example, this walkthrough
uses the c:\altera\projects\crc_project directory.
b. Specify the name of the project. This walkthrough uses example for the project
name.
1The Quartus II software automatically specifies a top-level design entity
that has the same name as the project. This walkthrough assumes the names
are the same.
5. Click Next to close this page and display the New Project Wizard: Add Files page.
1When you specify a directory that does not already exist, a message asks
you if the specified directory should be created. Click Yes to create the
directory.
6. If you installed the MegaCore IP Library in a different directory from where you
installed Quartus II, you must add the user libraries:
a. Click User Libraries.
b. Type <path>\ip\altera in the Library name box, where <path> is the
directory in which you installed the CRC compiler.
c. Click Add to add the path to the Quartus II project.
d. Click OK to save the library path in the project.
7. Click Next to close this page and display the New Project Wizard: Family &
Device Settings page.
8. On the New Project Wizard: Family & Device Settings page, choose the target
device family in the Family list.
9. The remaining pages in the New Project Wizard are optional. Click Finish to
complete the Quartus II project setup.
You have finished creating your new Quartus II project.
c You may only use these models for simulation and expressly not for synthesis or any
To generate a simulation model or a netlist, click Next (or the EDA tab) to display the
EDA page. Turn on the options as required.
An IP functional simulation model is a cycle-accurate VHDL or Verilog HDL model
produced by the Quartus II software. The model allows for fast functional simulation
of IP using industry-standard VHDL and Verilog HDL simulators.
other purposes. Using these models for synthesis creates a nonfunctional design.
To generate an IP functional simulation model for your MegaCore function, follow
these steps:
1. Turn on Generate Simulation Model.
1Some third-party synthesis tools can use a netlist that contains only the
structure of the MegaCore function, but not detailed logic, to optimize
performance of the design that contains the MegaCore function. Turn on
Generate netlist only if your synthesis tool supports this feature.
2. Click Next (or the Summary tab) to display the Summary page.
You can use the check boxes on the Summary page to enable or disable the generation
of specified files. A gray checkmark indicates a file that is automatically generated;
other files are optional.
You can click Back to display the previous page or click Parameter Setting, EDA or
Summary, if you want to change any of the MegaWizard options.
Generate Files
To generate the files, follow these steps:
1. Turn on the files you wish to generate.
1At this stage you can still click Back or the pages to display any of the other
pages in the MegaWizard interface, if you want to change any of the
parameters.
2. To generate the specified files and close the MegaWizard interface, click Finish.
The Generation Status Window appears. After file generation is successful, click
Exit to close the window.
1The generation phase may take several minutes to complete. The
generation status window tells you the files that are generated and reports
whether the generation phase was successful or not.
3. After you review the generation report, click Exit to close the MegaWizard Plug-In
Manager and click Yes on the Quartus II IP Files message.
1The Quartus II IP File (.qip) is a file generated by the MegaWizard interface
or SOPC Builder that contains information about a generated IP core. You
are prompted to add this .qip file to the current Quartus II project at the
time of file generation. In most cases, the .qip file contains all of the
necessary assignments and information required to process the core or
system in the Quartus II compiler. Generally, a single .qip file is generated
for each MegaCore function and for each SOPC Builder system. However,
some more complex SOPC Builder components generate a separate .qip
file, so the system .qip file references the component .qip file.
Tab le 2– 1 describes the generated files and other files that may be in your project
directory. The names and types of files specified in the summary vary based on
whether you created your design with VHDL or Verilog HDL.
Table 2–1. Generated Files (Sheet 1 of 2)
File Name Description
<variation name>.bsfQuartus II symbol file for the MegaCore function variation.
You can use this file in the Quartus II block diagram editor.
<variation name>.cmpA VHDL component declaration file for the MegaCore
function variation. Add the contents of this file to any VHDL
architecture that instantiates the MegaCore function.
<variation name>.htmlReport file which contains lists of the generated files and
ports for the MegaCore function variation.
<variation name>.vo or .vhoVHDL or Verilog HDL IP functional simulation model.
<variation name>.vhd or .vA MegaCore function variation file, which defines a VHDL
or Verilog HDL top-level description of the custom
MegaCore function. Instantiate the entity defined by this
file inside of your design. Include this file when compiling
your design in the Quartus II software.
<variation name>_bb.vVerilog HDL black-box file for the MegaCore function
variation. Use this file when using a third-party EDA tool to
synthesize your design.
<variation name>.qipContains Quartus II project information for your MegaCore
function variations.
<variation name>_syn.vA timing and resource estimation netlist for use in some
third-party synthesis tools. This file is generated when the
option Generate netlist on the EDA page is turned on.
testbench/tb.v(hd) or
testbench/tb_multichan.v(hd)
testbench/crcdemo.v(hd) or
testbench/crcdemo_multichan.v(hd)
testbench/crcgen.v(hd) or
testbench/crcgen_multichan.v(hd)
testbench/crcchk.v(hd) or
testbench/crcchk_multichan.v(hd)
A Verilog or VHDL testbench file that provides a testbench
for the CRC compiler MegaCore function variation.
A Verilog or VHDL example design incorporating a CRC
generator, checker, and other supporting models.
Wrapper for example variations of the CRC Compiler
MegaCore function used in the testbench.
Wrapper for example variations of the CRC Compiler
MegaCore function used in the testbench.
Simulate the Design
You can now integrate your custom MegaCore function variation into your design,
simulate, and compile your design.
Simulate the Design
You can simulate your design using the MegaWizard-generated VHDL or Verilog
HDL IP functional simulation models. These simulation models are generated in the
language you selected in “Set Up Simulation” on page 2–4.
For an example of simulating a design, refer to the section, “Running the Testbench
Example” on page 3–8.
fFor more information on IP functional simulation models, refer to the Simulating
Altera IP in Third-Party Simulation Tools chapter in volume 3 of the Quartus II
Handbook.
Compile the Design
You can use the Quartus II software to compile your design. Refer to Quartus II Help
for instructions on compiling your design.
Program a Device
After you compile your design, program your targeted Altera deviceand verify your
design in hardware.
The CRC Compiler MegaCore function generates high-performance circuits to
generate or check Cyclic Redundancy Check checksums for packet-based
communication. The CRC Compiler dynamically generates RTL based on
requirements you supply, rather than parameterizing static RTL.
The generated CRC MegaCore function uses an Avalon-ST interface to receive data.
Generated checksums for transmission or the status of received checksums are
emitted on dedicated ports. The CRC MegaCore function does not provide an
Av al on
®
interface. The generated CRC MegaCore function also does not store any data,
checksums, or status.
CRC Generator
3. Functional Description
Memory-Mapped (Avalon-MM) interface or any other software access
Figure 3–1 shows the block diagram of the CRC generator.
Figure 3–1. CRC Generator Block Diagram
Note to Figure 3–1:
(1) These signals are present only in a multi-channel generator.
The CRC Generator receives message bits from the data input interface on each clock
cycle during which datavalid is asserted. The datavalid signal may be asserted
or deasserted arbitrarily during or between packets. When datavalid is asserted,
all data pins must contain valid data and the empty signal must be zero, with the
exception of the final word of a packet. The empty signal, if used, must be set to zero
during all cycles except the last word of a packet, that is when endofpacket is
asserted. If datavalid is deasserted, data, startofpacket, endofpacket, and
empty are ignored. Following a fixed number of clock cycles after the final word,
indicated by assertion of endofpacket, crcvalid is asserted and the computed
CRC value is available on the checksum output. The value of checksum is
undefined at other times. For the delay between assertion of endofpacket and crcvalid, refer to the Latency panel of the MegaWizard interface.
The CRC generator can start computing the checksum of a new packet while it is
completing the calculation for the previous packet, that is before it asserts crcvalid.
The data source may assert startofpacket on the clock cycle immediately
following endofpacket, regardless of the generator's latency.
Figure 3–2 and Figure 3–3 shows a typical application of the CRC Generator and
Figure 3–4 shows the block diagram for the CRC Checker.
Figure 3–4. CRC Checker Block Diagram
CRC CHECKER
clk
reset_n
data
datavalid
startofpacket
endofpacket
empty
datachannel
Note to Figure 3–4:
(1) These signals are present only in a multi-channel checker.
(1)
crcbad
crcvalid
chaninitdone
crcchannel
(1)
(1)
The CRC Compiler MegaCore function receives message and checksum (codeword)
bits from the data input interface on each clock cycle during which datavalid is
asserted. The datavalid signal can be asserted or deasserted arbitrarily during or
between packets as shown in Figure 3–5 on page 3–3 and Figure 3–6 on page 3–4.
When datavalid is asserted, all data pins must contain valid data and the empty
signal must be zero, with the exception of the final word of a packet. The empty
signal, if used, must be set to 0 during all cycles except the last word of a packet, that
is when endofpacket is asserted. If datavalid is deasserted, data, startofpacket, endofpacket, and empty are ignored. Following a fixed number
of clock cycles after the final word, indicated by assertion of endofpacket, crcvalid is asserted and the crcbad output is set to 1 if the calculated syndrome is
incorrect. The value of crcbad is undefined at other times. For the delay between
assertion of endofpacket and crcvalid, refer to the Latency panel of the
MegaWizard interface.
The CRC checker can start computing the checksum of a new packet while it is
completing the calculation for the previous packet, that is before it asserts crcvalid.
The data source may assert startofpacket on the clock cycle immediately
following endofpacket, regardless of the checker's latency.
For multi-channel (Number of CRC Channels > 1) operations, the CRC Compiler
inserts context memories which allow a generator or checker to process multiple
packets concurrently. Both speed and area optimization variants support multichannel operation.
On each datavalid cycle, user applications must set the datachannel input signal
to the channel context in use. The MegaCore function sets the crcchannel output
signal to the same value after a fixed number of clock latency (at the assertion of
crcvalid), to indicate the channel the crcbad or checksum output signal applies
to.
There is no channel switch latency or minimum number of cycles between context
switches, and no restriction on channel ordering is imposed. The latency of a multichannel MegaCore function is identical to that of the corresponding single-channel
MegaCore function.
However, there is an fmax penalty in multi-channel operation. After each system reset
(reset_n = 0), there will be a slight delay in terms of the number of clock cycles due
to an internal initialization of the context to a known state. The chaninitdone
output signal is asserted when the internal initialization is done. You must wait until
this output signal is asserted before sending any data to the MegaCore function for
processing.
Preliminary
Chapter 3: Functional Description3–5
Multi-Channel Operation
Figure 3–8 shows the operation of a multi-channel generator.
Figure 3–8. Multi-Channel Generator Operation
clk
datachannel
010
101
000
chaninitdone
startofpacket
endofpacket
data
data1data2data4data1data3data4
data3data2data1data2
datavalid
crcchannel
010
crcvalid
checksum
checksum
Figure 3–9 and Figure 3–10 show the operation of a multi-channel checker when
processing a good and incorrect codeword, respectively.
Figure 3–9. Multi-Channel Checker Operation with Good Codeword
You specify the parameters for the CRC Compiler MegaCore functions using the
MegaWizard interface. Tab le 3– 1 describes each available parameter.
Table 3–1. MegaWizard Control Settings
ParameterDescription
CRC GeneratorCreates a generator MegaCore function
CRC CheckerCreates a checker MegaCore function
Number of CRC ChannelsSpecifies the number of CRCs supported. All input and output signals are shared
among the channels. Hence, only 1 channel can be processed at any one time.
DatapathSelects the width of the data input
Symbols per wordSpecifies the number of symbols in a datapath, and thus defines the width of each
symbol in bits. A symbol represents the smallest unit of data in a word. For
example, if Datapath is set to 32 bits and Symbols per word is set to 4, the width of
each symbol is 8 bits.
Process low-numbered bit in each
symbol first
Process low-numbered symbol firstProcesses the symbols in reverse order. For example, given the Datapath is 12 bits
Register all Avalon-ST inputsBuffers data, datavalid, startofpacket, endofpacket, and empty
Optimize for: speedInserts logic to increase the maximum clock speed
Optimize for: areaRemoves logic to reduce logic utilization and latency
CRC CodeSelects the generator polynomial by name
Starting valuePresets the CRC register to this value before each packet.
Number of leading bits to ignore in
First word
Negate checksumSets checksum to the one’s complement of the result of the polynomial division.
Bit-swap checksumApplies only to CRC Generator. Selecting this parameter reverses the sequence of
Register all outputsBuffers crcvalid and checksum, or crcbad with flip-flops.
Processes each symbol in reverse order. For example, given the Datapath is 12 bits
and Symbols per word is 3, turning on this parameter causes the MegaCore
function to process “abcd efgh ijkl” as “dcba hgfe lkji”.
and Symbols per word is 3, turning on this parameter causes the MegaCore
function to process “abcd efgh ijkl” as “ijkl efgh abcd”.
If both parameters, Process low-numbered bit in each symbol first and Process low-numbered symbol first are turned on, the MegaCore processes the entire data
in reverse order.
signals with flip-flops
Specifies the number of bits to ignore at the beginning of a packet.
Not applicable to the CRC checker.
the entire output bits. The low-order bits of the remainder are placed in the highorder bits of the checksum. Select this parameter if data transmission starts from
low-order bit.
Tab le 3– 2 describes the I/O signals of a CRC MegaCore function.
Table 3–2. CRC Signals
SignalDirectionDescription
clkInSystem clock.
reset_nInAsynchronous reset signal, which is active at 0.
data[(n-1):0]InMessage bits for generator; codeword bits for checker, where n is a power of 2,
from 1 through 256, (1, 2, 4, 8,16, 32, 64,128, or 256).
datavalid InAsserted by the source to indicate new packet data.
startofpacketInAsserted by the source to mark the beginning of a packet. This signal is present
only when the parameter Optimize for: speed is set to ON or Number of leading
bits to ignore in First word is greater than 0.
endofpacketInAsserted by the source to mark the end of a packet.
empty[(n-1):0] InThe number of empty symbols during cycles that contain the end of a packet.
This signal must be set to 0 during other cycles when datavalid is
asserted. The value of n equals log
is present only when the parameter Symbols per word is greater than 1.
checksum[(n-1):0]OutComputed CRC output, where n equals the order of the generator polynomial.
This signal is present only in CRC generator.
crcbad OutAsserted if the previous packet had an incorrect CRC. This signal is present only
in CRC checker.
crcvalid OutAsserted when the core has completed calculation of the checksum or
crcbad value.
Multi-Channel Signals
datachannel[(n-1):0]InThe channel on which data is received by the generator or checker. The value of
n equals log
(number of CRC channels).
2
chaninitdoneOutAsserted when the MegaCore function has completed its internal initialization
process and ready to receive data for processing. User applications must wait
for chaninitdone to be asserted before sending data to the MegaCore
function for processing. The MegaCore function reinitializes itself each time the
reset_n signal is asserted.
crcchannel[(n-1):0]OutIndicates the channel whose result is presented at the checksum (generator)
or crcbad (checker) output signal. The value of n equals log
channels).
(number of symbols per word). This signal
2
(number of CRC
2
Testbench
The testbench shows you a typical variant created by the CRC Compiler. The variant
and the testbench are fixed and may differ from the variant you create.
The testbench is available in both Verilog and VHDL, plaintext except for the CRC IP
Functional Simulation models. The testbench models are synthesizable RTL which
allows you to compile and to run the testbench in hardware. The architecture is
shown in Figure 3–11.
The packet generator module creates sample message words (packets without CRCs).
The CRC generator creates a checksum, which the merge module appends to the end
of the packet. The merge module delays the data to account for generator processing
time. The result is a codeword. The channel module inserts errors in the codewords,
as indicated by the errorInserted signal. The CRC checker indicates the presence
of errors in the received codewords. The testbench shows detected errors using the
errorDetected signal.
Running the Testbench Example
In this section you run the testbench example to illustrate how you do the following
tasks:
■ Create a testbench project using the Quartus II New Project Wizard
■ Create simulation models for the generator and checker using the MegaWizard
interface
■ Set EDA Tool Settings to simulate your testbench project
■ Run compilation and analysis
When you create a MegaCore function variation and turn on the Generate
Simulation Model option on the EDA page, the Quartus II software generates the
simulation model in the project directory. The simulation model is an Intellectual
Property Functional Simulation (IPFS) model with a file extension of .vo or .vho,
depending on the language you select. It also creates an example design in the
testbench subdirectory. The testbench subdirectory contains the data generator,
merge, and channel modules for the example testbench in the following files:
■ A top-level simulation file, tb.v or tb.vhd.
■ crcdemo.v(hd) for a single channel MegaCore function or
crcdemo_multichan.v(hd) for a multichannel MegaCore function
■ A generator variation file, crcgen.v(hd) for a single channel MegaCore function or
crcgen_multichan.v(hd) for a multichannel MegaCore function.
■ The corresponding checker variation file, crcchk.v(hd) for a single channel
MegaCore or crcchk_multichan.v(hd) for a multichannel MegaCore.
The CRC demonstration testbench is supported by the following simulators:
Ve r il o g : Mentor ModelSim SE and AE, Cadence NCSim, Synopsys VCS and VCSMX
VHDL: Mentor ModelSim SE and AE, Cadence NCSim, and Synopsys VCS-MX.
For up-to-date information on the supported versions of these simulators, reference
the Altera website: www.altera.com.
Create a New Project for the Testbench
Following the steps below, create a Quartus II project in the testbench directory.
1. Choose New Project Wizard (File menu).
2. Click Next in the New Project Wizard Introduction page (the introduction page
does not display if you turned it off previously).
3. In the New Project Wizard: Directory, Name, Top-Level Entity page, enter the
following information:
a. Specify the working directory for your testbench project, which should be the
testbench directory created in your previous project directory. For example,
this walkthrough uses the directory c:\altera\projects\crc_project\testbench.
b. Specify crcdemo for the name of the project.
The Quartus II software automatically specifies a top-level design entity that
has the same name as the project. This walkthrough assumes the names are the
same.
c. If the directory already exists, a dialog displays that asks what action to take.
Click the Delete the existing project and continue using the New Project Wizard and then click OK to continue.
4. The New Project Wizard: Add Files page displays.
a. Select the file crcdemo.v or crcdemo.vhd, depending on the language in which
your MegaCore function was created, and click Add to add the file to your
project.
b. Click Finish to add the file to your project.
Create the Generator and Checker Files
In this section, you create the generator and checker variation files.
1. Open the MegaWizard Plug-In Manager and click Edit an existing custom
megafunction variation to edit the CRC generator wrapper file crcgen.v or
crcgen.vhd
2. Click Next to display the page from which you select the generator wrapper file,
crcgen.v or crcgen.vhd, in the testbench directory.
3. After you select the crcgen.v or crcgen.vhd the file, click Next to continue.
1You can review the parameters, but it is recommended that you don’t
4. Click the Simulation tab and ensure that Generate Simulation Model is checked.
Click Finish to create the IPFS model for the CRC generator.
5. The generation window displays the files being generated and the generation
status. After the files are generated successfully, click Exit.
Create a Simulation Model for the Checker
1. Open the MegaWizard Plug-In Manager again (see Step 1 in the previous
section“Create the Generator and Checker Files” on page 3–9) to edit the CRC
checker wrapper file crcchk.v or crcchk.vhd, in the testbench directory.
2. Click Next to display the page from which you select the CRC checker wrapper
file, crcchk.v or crcchk.vhd.
3. After you select the crcchk.v or crcchk.vhd the file, click Next to continue.
1You can review the parameters, but it is recommended that you don’t
change the settings.
4. Click the Simulation tab and ensure that Generate Simulation Model is checked.
5. Click Finish to create the IPFS model for the CRC checker.
Compile and Simulate the Testbench
In this section, you navigate the Quartus II software interface to compile and simulate
the testbench.
1. Using the Quartus II software, open the Assignments/EDA Tool Settings... menu,
then click the plus sign (+) to expand the EDA Tool Settings category and select
Simulation to display the Quartus II Simulation page.
2. Set the Tool Name to the simulator of your choice. In this example, it is ModelSim-
Altera.
3. Click Compile test bench: in the NativeLink settings, then click Test Benches...
4. In the Test Benches page, click New...
5. In the New Test Bench Settings page, set Test bench name:, Test bench entity:, and
Instance: all to tb. Set Run for: to 100 us. In the Test bench files, set File name: to
tb.v or tb.vhd and then click Add.
6. Click OK to apply these settings. The Test Benches page displays the settings.
7. You can review the testbench settings. If these setting are correct, click OK to
confirm this is the testbench file and settings that you want to use.
8. Click OK to close the EDA Tools ->Simulation page.
9. Open the Tools->Options menu and select EDA Tool Options.
10. Double-click the simulator you chose in Step 1 and enter the path to the
executable. Click OK to close the EDA Tool Options page.
11. In the Quartus II Processing menu, select Start->Start Analysis & Elaboration.
After the testbench compiles successfully, a message displays telling you that the
compilation was successful and informs you of the number of warnings that exist.
13. In the Quartus II Tools menu, select EDA Simulation Tool->Run EDA RTL Simulation.
14. The Quartus II software starts the simulator you chose in interactive mode and
simulates the design. Consult the vendor's documentation for information on how
to use the simulator. When you have finished using the simulator, quit the
simulator and continue using Quartus II software.
The following table shows the typographic conventions that this document uses.
Visual CueMeaning
Bold Type with Initial Capital
Letters
bold type Indicates directory names, project names, disk drive names, file names, file name
Italic Type with Initial Capital Letters Indicates document titles. For example, AN 519: Stratix IV Design Guidelines.
Italic type Indicates variables. For example, n + 1.
Initial Capital LettersIndicates keyboard keys and menu names. For example, Delete key and the Options
“Subheading Title”Quotation marks indicate references to sections within a document and titles of
Courier typeIndicates signal, port, register, bit, block, and primitive names. For example, data1,
1., 2., 3., and
a., b., c., and so on.
■ ■Bullets indicate a list of items when the sequence of the items is not important.
1 The hand points to information that requires special attention.
c
w
r The angled arrow instructs you to press Enter.
f The feet direct you to more information about a particular topic.
Indicates command names, dialog box titles, dialog box options, and other GUI
labels. For example, Save As dialog box.
extensions, and software utility names. For example, \qdesigns directory, d: drive,
and chiptrip.gdf file.
Variable names are enclosed in angle brackets (< >). For example, <file name> and
<project name>.pof file.
menu.
Quartus II Help topics. For example, “Typographic Conventions.”
tdi, and input. Active-low signals are denoted by suffix n. For example,
resetn.
Indicates command line commands and anything that must be typed exactly as it
appears. For example, c:\qdesigns\tutorial\chiptrip.gdf.
Also indicates sections of an actual file, such as a Report File, references to parts of
files (for example, the AHDL keyword SUBDESIGN), and logic function names (for
example, TRI).
Numbered steps indicate a list of items when the sequence of the items is important,
such as the steps listed in a procedure.
A caution calls attention to a condition or possible situation that can damage or
destroy the product or your work.
A warning calls attention to a condition or possible situation that can cause you
injury.