[source]

Entity arith_scaler

MULSDIVSclkstd_logicrststd_logicstartstd_logicargstd_logic_vectormsel[log2ceil ( MULS ' length ) - 1 downto 0]std_logic_vectordsel[log2ceil ( DIVS ' length ) - 1 downto 0]std_logic_vectordonestd_logicresstd_logic_vector

Block Diagram of arith_scaler

A flexible scaler for fixed-point values. The scaler is implemented for a set of multiplier and divider values. Each individual scaling operation can arbitrarily select one value from each these sets.

The computation calculates: unsigned(arg) * MULS(msel) / DIVS(dsel) rounded to the nearest (tie upwards) fixed-point result of the same precision as arg.

The computation is started by asserting start to high for one cycle. If a computation is running, it will be restarted. The completion of a calculation is signaled via done. done is high when no computation is in progress. The result of the last scaling operation is stable and can be read from res. The weight of the LSB of res is the same as the LSB of arg. Make sure to tap a sufficient number of result bits in accordance to the highest scaling ratio to be used in order to avoid a truncation overflow.

Generics

Name

Type

Default

Description

MULS

T_POSVEC

(0 => 1)

The set of multipliers to choose from in scaling operations.

DIVS

T_POSVEC

(0 => 1)

The set of divisors to choose from in scaling operations.

Ports

Name

Type

Direction

Description

clk

std_logic

in

rst

std_logic

in

start

std_logic

in

Start of Computation

arg

std_logic_vector

in

Fixed-point value to be scaled

msel

std_logic_vector

in

dsel

std_logic_vector

in

done

std_logic

out

Completion

res

std_logic_vector

out

Result