GithubHelp home page GithubHelp logo

efabless / ef_tcc32 Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 368 KB

A 32-bit Timer/Counter/Capture Soft IP (Verilog)

License: MIT License

Verilog 96.19% C 2.58% SystemVerilog 1.11% Makefile 0.12%

ef_tcc32's Introduction

EF_TCC32

A 32-bit Timer/Counter/Capture Soft IP in Verilog HDL. It has a generic bus interface compatible with wrapper_gen.py. Three bus wrappers are provided for: AHB-Lite, APB and WB.

Features

  • Up/Down Counting
  • One Shot or Periodic Timer
  • External Events Capturing/Counting
  • 8-bit Clock Prescaler (Timer only)
  • 3 Interrupt sources
    • Timer Time-out
    • Counter Match
    • Event Capture

The Interface

EF_TCC32

Port name Direction Type Description
clk input Clock
rst_n input Active low reset
ctr_in input External events input
period input [31:0] 32-bit Timer Period
ctr_match input [31:0] 32-bit match value (counter mode)
tmr output [31:0] Current timer value
cp_count output [31:0] Current counter value
clk_src input [3:0] clk source (9: ctr_in, 8: clk, 0-7: clk/2 to clk/256)
to_flag output Time out flag
match_flag output Match flag
tmr_en input Timer enable
one_shot input One Shot mode enable (default: periodic)
up input Up counting enable (default: down counting)
cp_en input External events capturing enable
cp_event input [1:0] External Event type (1: posedge, 2: negedge, 3: both)
cp_flag output Capture event received flag
en input Global enable

EF_TMR32 Internals

Diagram

Modes of Operation

mode tmr_en cp_en clk_src description
Timer 1 0 0-8 Counts clock cycles to keep track of time.
- clk_src 8: clk, 0-7: clk/2 to clk/256
- up: 0: down counting (period to 0), 1: up counting (0 to period)
- one_shot: 0:periodic, 1:one shot
- period: starting/terminal count for down/up counting.
- to_flag: is set when the tmr reaches the terminal count (up:period, down:0)
Counter 1 0 9 Similar to the Timer but it counts external pulses coming on ctr_in.
match_flag is set when tmr matches ctr_match. The counting can be up/down and to/from period register
Event Capture 1 1 0-8 Capture the time between two events on ctr_in.
cp_event sets the event: 1:Raising Edge, 2:Falling Edge or 3:Both.
cp_flag is set when two two consecutive events are observed; once set, cp_count shows the current count.

I/O Registers

Timer Value Register [offset: 0x00, RO]

Diagram

Timer Period Register [offset: 0x04, RW]

Diagram

PWM Compare Register [offset: 0x08, RW]

Diagram

Counter Match Register [offset: 0x0C, RW]

Diagram

Control Register [offset: 0x100, RW]

Diagram

Raw Interrupts Status Register [offset: 0xF00, RO]

Reflects the status of interrupts trigger conditions detected (raw, prior to masking).

  • to: Time-out Flag
  • cp: Capture Flag
  • match: Match Flag

Diagram

Masked Interrupts Status Register [offset: 0xF04, RO]

Similar to RIS but shows the state of the interrupt after masking. MIS register is always RIS & IM. Diagram

Interrupts Mask Register [offset: 0xF08, RW]

Disabling/ENabling an interrupt source. Diagram

Interrupt Clear Register [offset: 0xF0C, RW]

Writing a 1 to a bit in this register clears the corresponding interrupt state in the RIS Register. Diagram

ef_tcc32's People

Contributors

shalan avatar ef-shalan avatar marwaneltoukhy avatar m0stafarady avatar passant5 avatar mo-hosni avatar

Stargazers

 avatar Lau avatar Mohamed Gaber avatar

Watchers

James Cloos avatar  avatar  avatar

ef_tcc32's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.