Skip to content

CLINT Datasheet

中文说明

Overview

The clint(core-local interruptor) IP is a fully parameterised soft IP implementing the RISCV Privilege Specification v1.1 compatible CLINT. The IP features an APB4 slave interface, fully compliant with the AMBA APB Protocol Specification v2.0.

Feature

  • 64-bit programmable mtime and mtimecmp counter
  • Software interrupt support
  • Static synchronous design
  • Full synthesizable

Interface

port nametypedescription
apb4interfaceapb4 slave interface
clint ->interfaceclint slave interface
clint.tmr_irq_ooutputtimer irq ouput
clint.sfr_irq_ooutputsoftware irq ouput

Register

nameoffsetlengthdescription
MSIP0x04machine mode software interrupt
MTIMECMPL0x40004machine timer compare low
MTIMECMPH0x40044machine timer compare high
MTIMEL0xbff84machine timer low
MTIMEH0xbffc4machine timer high

Machine Mode Software Interrupt

bitaccessdescription
[31:1]nonereserved
[0:0]RWMSIP

reset value: 0x0000_0000

  • MSIP: this bit is reflected in MSIP of the mip CSR. A machine-level software interrupt for a HART is pending or cleared by writing 1 or 0 respectively to the corresponding this MSIP bit

Machine Timer Low

bitaccessdescription
[31:0]ROMTIMEL

reset value: 0x0000_0000

  • MTIMEL: the low 32-bit of 64-bit mtime CSR register

Machine Timer High

bitaccessdescription
[31:0]ROMTIMEH

reset value: 0x0000_0000

  • MTIMEH: the high 32-bit of 64-bit mtime CSR register

Machine Timer Compare Low

bitaccessdescription
[31:0]RWMTIMECMPL

reset value: 0xFFFF_FFFF

  • MTIMECMPL: the low 32-bit of 64-bit mtimecmp CSR register

Machine Timer Compare High

bitaccessdescription
[31:0]RWMTIMECMPH

reset value: 0xFFFF_FFFF

  • MTIMECMPH: the high 32-bit of 64-bit mtimecmp CSR register

Program Guide

The software operation of clint is simple. These registers can be accessed by 4-byte aligned read and write. the C-like pseudocode of the timer interrupt operation:

c
clint.MTIMECMPL = MTIMECMP_LOW_32_bit  // write low 32-bit mtimecmp register
clint.MTIMECMPH = MTIMECMP_HIGH_32_bit // write high 32-bit mtimecmp register
... // some codes

// === mtime interrupt handle start ===
// add new value to the mtime interrupt
clint.MTIMECMPL = UPDATE_DELTA_VALUE & 0x0000FFFF
clint.MTIMECMPH = UPDATE_DELTA_VALUE & 0xFFFF0000
// === mtime interrupt handle end ===

... // some codes

software interrupt operation:

c
clint.MSIP = 1 // trigger software interrupt
... // some codes

// === software interrupt handle start ===
clint.MSIP = 0 // clear the software interrupt
// === software interrupt handle end ===

... // some codes

The trimmed reference keeps the RTL interface example only; it does not include a standalone CLINT software driver.

Resoureces

References

Revision History

文档以中文为第一语言,并提供对应英文版本。