Axi Timer V2.0: Logicore Ip Product Guide
Axi Timer V2.0: Logicore Ip Product Guide
Axi Timer V2.0: Logicore Ip Product Guide
Chapter 1: Overview
Functional Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Feature Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Licensing and Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Appendix A: Debugging
Finding Help on Xilinx.com . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Debug Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Hardware Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Interface Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Notes:
1. For a complete list of supported devices, see the Vivado
IP catalog.
2. Standalone driver details can be found in the SDK directory
(<install_directory>/doc/usenglish/xilinx_drivers.htm). Linux
OS and driver support information is available from the Xilinx
Wiki page.
3. For the supported versions of the tools, see the
Xilinx Design Tools: Release Notes Guide.
Overview
Functional Description
The AXI Timer is organized as two identical timer modules as shown in Figure 1-1. Each
timer module has an associated load register that is used to hold either the initial value for
the counter for event generation or a capture value, depending on the mode of the timer.
The generate value, which is the value loaded into the load register, is used to generate a
single interrupt at the expiration of an interval or a continuous series of interrupts with a
programmable interval. The capture value is the timer value that has been latched on
detection of an external event. The clock rate of the timer modules is s_axi_aclk (no
prescaling of the clock is performed). All of the timer/counter interrupts are OR’ed together
to generate a single external interrupt signal. The interrupt service routine reads the
control/status registers to determine the source of the interrupt.
The block diagram of AXI Timer, also known as AXI Timer/Counter, is shown in Figure 1-1.
X-Ref Target - Figure 1-1
$;,7,0(5&2817(5
$;,/LWH $;,/LWH,QWHUIDFH
7LPHU5HJLVWHUV
;
Operation Overview
The AXI Timer/Counter modules provides an AXI4-Lite interface to communicate with the
host. The timer/counter design has the following key modules:
Timer Modes
Four modes can be used with the two Timer/Counter modules:
• Generate Mode
• Capture Mode
• Pulse Width Modulation Mode
• Cascade Mode
Generate Mode
In the Generate mode, the value in the load register is loaded into the counter. The counter,
when enabled, begins to count up or down, depending on the selection of the Up/Down
Count Timer (UDT) bit in the Timer Control Status Register (TCSR). See Figure 2-2, page 12
and Figure 2-5, page 15. On transition of the carry out of the counter, the counter stops or
automatically reloads the generate value from the load register and, after reaching the
timeout value, continues counting as selected by the Auto Reload/Hold (ARHT) bit in the
TCSR. The Timer Interrupt Status (TINT) bit is set in TCSR and, if enabled, the external
GenerateOut signal is driven to 1 for one clock cycle.
If enabled, the interrupt signal for the timer is driven to 1 when reaching the timeout value.
Clear the interrupt by writing a 1 to the Timer Interrupt register. Use this mode for
generating repetitive interrupts or external signals with a specified interval.
Capture Mode
In Capture mode, the value of the counter is stored in the load register when the external
capture signal is asserted. The TINT bit is also set in the TCSR on detection of the capture
event. The counter can be configured as an up or down counter for this mode as
determined by the selection of the UDT bit in TCSR. The Auto Reload/Hold (ARHT) bit
controls whether the capture value is overwritten with a new capture value before the
previous TINT flag is cleared. Use this mode for time-tagging external events while
simultaneously generating an interrupt.
Cascade Mode
In the Cascade mode, the two timer/counters are cascaded to operate as a single 64-bit
counter/timer. The cascaded counter can work in both generate and capture modes. TCSR0
acts as the control and status register for the cascaded counter. TCSR1 is ignored in this
mode.
Use this mode when a timer/counter more than 32-bits wide is required. Cascaded
operation requires using Timer 0 and Timer 1 together as a pair. The counting event for
Timer 1 is when Timer 0 rolls over from all 1s to all 0s, or vice-versa when counting down.
Interrupts
The TC interrupt signals can be enabled or disabled with the Enabel Interrupt for Timer
(ENIT) bit in the TCSR. The interrupt status bit (TINT) in the TCSR cannot be disabled and
always reflects the current state of the timer interrupt. In Generate mode, a timer interrupt
is caused by the counter rolling over (the same condition used to reload the counter when
ARHT is set to 1). In Capture mode, the interrupt event is the capture event.
Feature Summary
The features of the AXI Timer/Counter core are as follows:
Applications
Applications of this core include:
Information about this and other Xilinx LogiCORE IP modules is available at the Xilinx
Intellectual Property page. For information on pricing and availability of other Xilinx
LogiCORE IP modules and tools, contact your local Xilinx sales representative.
Product Specification
This chapter contains specific details about the performance and resource utilization of the
core.
Performance
Performance characterization of this core has been done using the margin system
methodology. The details of the margin system characterization methodology is described
in the Vivado Design Suite User Guide: Designing With IP (UG896) [Ref 13].
The summary of performance F MAX with this core performed on margin system is provided
in Table 2-1.
Note: The performance numbers for UltraScale™ architecture-based and Zynq®-7000 devices are
expected to be similar to 7 series device numbers.
Resource Utilization
Resources required for the AXI Timer core has been estimated for the 7 series FPGAs
(Table 2-2). These values were generated using the Vivado® Design Suite.
The AXI Timer resource utilization for various parameter combinations measured on a 7
series device are detailed in Table 2-2.
Note: Resources numbers for UltraScale and Zynq-7000 devices are expected to be similar to 7
series device numbers.
Table 2-2: Performance and Resource Utilization: 7 Series and Zynq-7000 Devices
Parameter Values Device Resources
Width of Timer/Counter Enable Timer2 Slices Flip-Flops LUTs
8 False 49 53 96
16 False 61 69 120
32 False 84 101 181
8 True 50 74 123
16 True 74 106 161
32 True 97 170 256
Port Descriptions
The AXI Timer input/output (I/O) signals are listed and described in Table 2-3.
Register Space
Timer Counter registers are accessed as one of these types:
• Byte (8 bits)
• Half word (2 bytes)
• Word (4 bytes)
The AXI Timer/Counter registers are organized as little-endian data. The bit and byte
labeling for the little-endian data types is shown in the Figure 2-1.
X-Ref Target - Figure 2-1
06%$GGU2IIVHW[$GGU2IIVHW[$GGU2IIVHW[/6%
%<7( %<7( %<7( %<7(
;
ARHT0 MDT0
ENALL T0INT ENIT0 GENT0
31 12 11 10 9 8 7 6 5 4 3 2 1 0
In cascade mode, TLR0 has the least significant 32-bits of the generate value and TLR1
should have the most significant bits of the generate value in generate mode. Similarly, in
cascade mode TLR0 has the captured value from TCR0 and TLR1 from TCR1.
31 0
TLRx
PG079_c2_03_082412
cascade mode, TCR0 has the least significant 32-bits of the 64-bit counter, and TCR1 has the
most significant bits.
X-Ref Target - Figure 2-4
31 0
TCRx
PG079_c2_04_082412
!2(4 -$4
%.!,, 4).4 %.)4 '%.4
Clocking
The AXI timer operates on s_axi_aclk.
Resets
The AXI timer resets when s_axi_aresetn is asserted. This is an active low signal and
should be synchronous to s_axi_aclk.
Programming Sequence
Generate Mode
The Generate mode has the following programming sequence:
• On start-up, the generate value in the load register is loaded into the counter by setting
the Load bit in the TCSR. This applies whether the counter is set up to Auto Reload or
Hold when the interval has expired. Setting the Load bit to 1 loads the counter with the
value in the load register. For proper operation, the Load bit must be cleared before the
counter is enabled or along with setting the enable bit. The timer/counter starts ticking
when Enable is set (ENT).
• When the ARHT bit (Auto Reload/Hold) is set to 1 and the counter rolls over from all 1s
to all 0s when counting up, or conversely from all 0s to all 1s when counting down, the
generate value in the load register is automatically reloaded into the counter and the
counter continues to count. If the GenerateOut signal is enabled (bit GENT in the
TCSR), an output pulse is generated (one clock period in width). This is useful for
generating a repetitive pulse train with a specified period.
• When the Auto Reload/Hold (ARHT) bit is set to 0 and the counter rolls over from all 1s
to all 0s when counting up, or conversely, from all 0s to all 1s when counting down, the
counter holds at the current value and does not reload the generate value. If the
GenerateOut signal is enabled (bit GENT in the TCSR), an output pulse of one clock
period in width is generated. This is useful for a one-shot pulse that is to be generated
after a specified period of time.
• The counter can be set up to count either up or down as determined by the selection of
the UDT bit in the TCSR. If the counter is set up as a down counter, the generate value is
the number of clocks in the timing interval. The period of the GenerateOut signal is
the generate value (value in load register TLRx) multiplied by the clock period.
• When the counter is set to count down,
TIMING_INTERVAL = (TLRx + 2) * AXI_CLOCK_PERIOD
where MAX_COUNT is the maximum count value of the counter, such as 0xFFFFFFFF for
a 32-bit counter.
Capture Mode
Capture mode has the following programming sequence:
• The mode for both Timer 0 and Timer 1 must be set to Generate mode (bit MDT in the
TCSR set to 0).
• The PWMA0 bit in TCSR0 and PWMB0 bit in TCSR1 must be set to 1 to enable PWM
mode.
• The GenerateOut signals must be enabled in the TCSR (bit GENT set to 1). The PWM0
signal is generated from the GenerateOut signals of Timer 0 and Timer 1, so these
signals must be enabled in both timer/counters.
• The assertion level of the GenerateOut signals for both timers in the pair must be set
to Active High.
• The counter can be set to count up or down.
where MAX_COUNT is the maximum count value for the counter, such as 0xFFFFFFFF
for a 32-bit counter.
Cascade Mode
In Cascade mode, the two timer/counters are cascaded to operate as a single 64-bit
counter/timer. The cascaded counter can work in both generate and capture modes. TCSR)
acts as the control and status register for the cascaded counter. TCSR1 is ignored in this
mode.
This mode is used when there is a requirement for a timer/counter more than 32 bits wide.
Cascaded operation requires using Timer 0 and Timer 1 together as a pair. The counting
event for the Timer 1 is when the Timer 0 rolls over from all 1s to all 0s or vice-versa when
counting down.
• Parameter enable_timer2 (Enable Timer 2) should be set to 0 because both timers are
required for a cascaded operation.
• The width of the AXI Timer should be 32 because it represents the width of each timer/
counter in the core.
• Load Registers of both timer/counters are used (TLR0 and TLR1 - TLR1 for higher 32-bit
and TLR0 for lower 32-bit). The value loaded into the load registers is called the
generate value in generate mode. And the capture value is captured in these load
registers in capture mode.
• Timer/counter 0 control register TCSR0, GenerateOut0, Capture event 0 are valid in
this mode. Timer 1 related signals are invalid, that is, TCSR1, GenerateOut1 and
CaptureEvent1 are not used. TCSR1 is used only for loading the TLR1 register.
• CASC bit in Timer Control Status Register 0 (TCSR0) must be set for the counters to be
in cascade mode. This bit must be set before enabling the timer/counter.
• The sequence of accesses for generate and capture modes are as mentioned in
previous sections.
• In generate mode, when the counter is set to count down,
TIMING_INTERVAL = (TLR + 4) * AXI_CLOCK_PERIOD
where TLR is the concatenated value of TLR1 and TLR0 (TLR = {TLR1, TLR0}).
The following are the steps for running the 64-bit counter/timer in generate mode:
1. Clear the timer enable bits in control registers (TCSR0 and TCSR1).
2. Write the lower 32-bit timer/counter load register (TLR0).
3. Write the higher 32-bit timer/counter load register (TLR1).
4. Set the CASC bit in Control register TCSR0.
5. Set other mode control bits in control register (TCSR0) as needed.
6. Enable the timer in Control register (TCSR0).
The following are the steps for reading the 64-bit counter/timer:
Interrupts
The programming requirements to enable/disable interrupts and the programming
sequence are as follows:
• Interrupt events can only occur when the timer is enabled. In Capture mode, this
prevents interrupts from occurring before the timer is enabled.
• The interrupt signal goes high when the interrupt condition is met and the interrupt is
enabled in the TCSR. The interrupt is asserted when the interrupt signal is High.
• A single interrupt signal is provided. The interrupt signal is the OR of the interrupts
from the two counters. The interrupt service routine must poll the TCSRs to determine
the source or sources of the interrupt.
• The interrupt status bit (TINT in the TCSR) can only be cleared by writing a 1 to it.
Writing a 0 to it has no effect on the bit. Because the interrupt condition is an edge (the
counter rollover or the capture event), it can be cleared at any time and does not
indicate an interrupt condition until the next interrupt event.
• In cascade mode, only Timer 0 interrupt events occur. There are no interrupts from
Timer 1.
• Vivado Design Suite User Guide: Designing IP Subsystems using IP Integrator (UG994)
[Ref 6]
• Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 13]
• Vivado Design Suite User Guide: Getting Started (UG910) [Ref 12]
• Vivado Design Suite User Guide: Logic Simulation (UG900) [Ref 7]
For details, see the Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 13] and
the Vivado Design Suite User Guide: Getting Started (UG910) [Ref 12].
Note: Figures in this chapter are illustrations of the Vivado Integrated Design Environment (IDE).
This layout might vary from the current version.
If you are customizing and generating the core in the Vivado IP Integrator, see the Vivado
Design Suite User Guide: Designing IP Subsystems using IP Integrator (UG994) [Ref 6] for
detailed information. IP Integrator might auto-compute certain configuration values when
validating or generating the design. To check whether the values do change, see the
description of the parameter in this chapter. To view the parameter value you can run the
validate_bd_design command in the tcl console.
• Enable 64-bit Mode: Check this box if an AXI Timer with a 64-bit width is needed. This
option disables the Timer 2 option because a 64-bit AXI Timer is created by cascading
2 timers inside the IP core.
• Width of the Timer/Counter (bits): Select 8, 16, 32 bit count widths based on user
requirements.
• Timer 1
Output Generation
For details, see the Vivado Design Suite User Guide: Designing with IP (UG896) [Ref 13].
Required Constraints
This section is not applicable for this IP core.
Clock Frequencies
This section is not applicable for this IP core.
Clock Management
This section is not applicable for this IP core.
Clock Placement
This section is not applicable for this IP core.
Banking
This section is not applicable for this IP core.
Transceiver Placement
This section is not applicable for this IP core.
Simulation
For details, see the Vivado Design Suite User Guide: Logic Simulation (UG900) [Ref 7].
Example Design
This chapter contains information about the example design provided in the Vivado®
Design Suite.
Overview
The top module instantiates all components of the core and example design that are
needed to implement the design in hardware, as shown in Figure 5-1. This includes the
clock generator (MMCME2), register configuration, data generator and data checker
modules.
X-Ref Target - Figure 5-1
&RPSRQHQWQDPH!BH[GHVYKGWRS
$;,7UDIILF $;,/LWH
*HQHUDWRU
'87 *ORZBOHG
&ORFN*HQHUDWRU
FORFNBJHQYKG
;
• Clock Generator: MMCME2 is used to generate the clocks for the example design.
MMCME2 is used to generate 100 MHz clock for s_axi_aclk. The DUT and other
modules of the example design are kept under reset until MMCME2 is locked.
• AXI Traffic Generator (ATG): This module (IP) is configured in the System Test mode.
All the AXI Timer-related AXI4-Lite transactions are stored in the COE file. For more
information on the AXI Traffic Generator, see the AXI Traffic Generator Product Guide
(PG125) [Ref 9]. The ATG automatically starts the AXI4-Lite transaction after coming out
of reset.
1. Right-click the core in the Hierarchy window, and select Open IP Example Design.
2. A new window pops up, asking you to specify a directory for the example design. Select
a new directory, or keep the default directory.
3. A new project is automatically created in the selected directory and opened in a new
Vivado window.
4. In the Flow Navigator (left side pane), click Run Implementation and follow the
directions.
The ATG writes value 0x45 to 0x00 register. This starts the timer counters. When the timer
value is reached certain count, the glow_led output drives 1. The glow_led output of the
example design is connected to the GPIO_LED7 of the KC705 evaluation board and indicates
the status of the example design. On successful completion of ATG write transactions to the
timer registers and counters initiation, the eighth LED is lit. If an error occurs, the
GPIO_LED7 is not lit.
The <component_name>_example/<component_name>_example.srcs/
sources_1/sim_1/imports/simulation directory contains the test bench file for the
example design: <component_name>_exdes_tb.vhd.
The <component_name>_example/<component_name>_example.srcs/
sources_1/constrs_1/imports/example_design directory contains the top-level
constraints file for the example design: <component_name>_exdes.xdc.
The XDC has all the necessary constraints needed to run the example design on the KC705
board. All the IO constraints are commented in the XDC file. Uncomment these constraints
before implementing the design on the KC705 board.
Simulation Results
The simulation script compiles the AXI Timer example design, and supporting simulation
files. It then runs the simulation and checks to ensure that it completed successfully.
If the test fails or does not end, the following message is displayed:
Test Bench
This chapter contains information about the test bench provided in the Vivado® Design
Suite.Figure 6-1 shows the test bench for AXI Timer example design. The top-level test
bench generates a 200 MHz clock and drives the initial reset to the example design.
X-Ref Target - Figure 6-1
WRSBWE
FORFNBLQ
FRPSRQHQWQDPH!BH[GHVYKG
WRS
*ORZBOHG
7HVW6WDWXV
;
Debugging
This appendix includes details about resources available on the Xilinx® Support website
and debugging tools.
Documentation
This product guide is the main document associated with the AXI Timer. This guide, along
with documentation related to all products that aid in the design process, can be found on
the Xilinx Support web page or by using the Xilinx Documentation Navigator.
Download the Xilinx Documentation Navigator from the Downloads page. For more
information about this tool and the features available, open the online help after
installation.
Answer Records
Answer Records include information about commonly encountered problems, helpful
information on how to resolve these problems, and any known issues with a Xilinx product.
Answer Records are created and maintained daily ensuring that users have access to the
most accurate information available.
Answer Records for this core are listed below, and can be located by using the Search
Support box on the main Xilinx support web page. To maximize your search results, use
proper keywords such as
• Product name
• Tool messages
• Summary of the issue encountered
A filter search is available after results are returned to further target the results.
AR:54438
Technical Support
Xilinx provides technical support in the Xilinx Support web page for this LogiCORE™ IP
product when used as described in the product documentation. Xilinx cannot guarantee
timing, functionality, or support if you do any of the following:
• Implement the solution in devices that are not defined in the documentation.
• Customize the solution beyond that allowed in the product documentation.
• Change any section of the design labeled DO NOT MODIFY.
To contact Xilinx Technical Support, navigate to the Xilinx Support web page.
1. Open a WebCase by clicking the Open a WebCase link located under Additional
Resources.
• Additional files based on the specific issue might also be required. See the relevant
sections in this debug guide for guidelines about which files to include with the
WebCase.
Debug Tools
There is one tool available to address AXI Timer design issues.
The Vivado logic analyzer is used to interact with the logic debug LogiCORE IP cores,
including:
See Vivado Design Suite User Guide: Programming and Debugging (UG908) [Ref 11].
Hardware Debug
Hardware issues can range from link bring-up to problems seen after hours of testing. This
section provides debug steps for common issues. The Vivado Lab Tools is a valuable
resource to use in hardware debug. The signal names mentioned in the following individual
sections can be probed using the Vivado Lab Tools for debugging the specific problems.
Many of these common issues can also be applied to debugging design simulations. Details
are provided on:
• General Checks
General Checks
Ensure that all the timing constraints for the core were properly incorporated from the
example design and that all constraints were met during implementation.
• Does it work in post-place and route timing simulation? If problems are seen in
hardware but not in timing simulation, this could indicate a PCB issue. Ensure that all
clock sources are active and clean.
• If using MMCMs in the design, ensure that all MMCMs have obtained lock by
monitoring the locked port.
• If your outputs go to 0, check your licensing.
Interface Debug
AXI4-Lite Interfaces
Read from a register that does not have all 0s as a default to verify that the interface is
functional. Output s_axi_arready asserts when the read address is valid, and output
s_axi_rvalid asserts when the read data/response is valid. If the interface is
unresponsive, ensure that the following conditions are met:
Parameter Changes
There are no parameter changes.
Port Changes
There are no port changes.
Xilinx Resources
For support resources such as Answers, Documentation, Downloads, and Forums, see
Xilinx® Support.
References
These documents provide supplemental material useful with this product guide:
Revision History
The following table shows the revision history for this document.