Example Documentation

PACKAGE math_pack IS

This package provides basic mathematic functions utilised all through the design

FUNCTION log2 RETURNS integer

This function calculates the base 2 logarithm of a number.

Parameters

Parameter

Type

Mode

Description

a

unsigned

in

The number of which to calculate the logarithm

ENTITY counter IS

This is a simple counter entity that counts the amount of passed input clock cycles up to max_value.

Generics

Generic

Type

Default

Description

max_value

integer

16

Determines how many clock cycles must pass before the buffer overflowing.

Ports

Port

Type

Mode

Description

IN_EN

std_logic

in

The input clock

OUT_EN

std_logic_vector(log2(max_value) - 1 downto 0)

out

The output signal

Constants

Constant

Type

Value

Description

CNT_WIDTH

natural

8

Width of counter

DATA_WIDTH

natural

8

Width of data stream