fplib - Reference Documentation

Generated by Sigasi 2024.2

Version 1.0.0

Table of Contents

Design Units

Project dr has 36 design units.

Module creal​_to​_sfp

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a real parameter (constant) to a sfp signal by rounding. This module is typically synthesizable, but Cadence Genus might require this tcl command: "set_db hdl_enable_real_support true". Reals that are outside the range of the ufp would throw an $error().

Parameters and Ports

Parameters

Name Type Default Value Description
float real 0.0

input real constant

Ports

Name Direction Type Description
fp inout sfp.out

output sfp signal

Module creal​_to​_ufp

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a real parameter (constant) to a ufp signal by rounding. This module is typically synthesizable, but Cadence Genus might require this tcl command: "set_db hdl_enable_real_support true". Reals that are outside the range of the ufp would throw an $error().

Parameters and Ports

Parameters

Name Type Default Value Description
float real 0.0

input real constant

Ports

Name Direction Type Description
fp inout ufp.out

output ufp signal

Module real​_to​_sfp

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a real input to an sfp signal by rounding. Reals that are outside the range of the sfp would throw an $error(). This module is NOT synthesizable!

Parameters and Ports

Ports

Name Direction Type Description
float input wire real

input real

fp inout sfp.out

output sfp signal

Always Blocks

  • unnamed : always_comb

Module real​_to​_ufp

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a real input to a ufp signal by rounding. Reals that are outside the range of the sfp would throw an $error(). This module is NOT synthesizable!

Parameters and Ports

Ports

Name Direction Type Description
float input wire real

input real

fp inout ufp.out

output ufp signal

Always Blocks

  • unnamed : always_comb

Module sfp​_add

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Addition of sfp signals followed by resizing (equivalant to sfp_add_full + sfp_resize)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 + in2)

Instantiations

Module sfp​_add​_full

This design unit is implemented in fp​_op​_full.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Addition of sfp signals with full precision. Output must have the correct iw/qw for a full width operation: out.iw = max(in1.iw, in2.iw) + 1 and out.qw = max(in1.qw, in2.qw)

Parameters and Ports

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 + in2)

Instantiations

Module sfp​_add​_ind

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Addition of sfp signals followed by resizing (equivalant to sfp_add_full + sfp_resize_ind)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 + in2)

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module sfp​_mult

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Multiplication of sfp signals followed by resizing (equivalant to sfp_mult_full + sfp_resize)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 * in2)

Instantiations

Module sfp​_mult​_full

This design unit is implemented in fp​_op​_full.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Multiplication of sfp signals with full precision. Output must have the correct iw/qw for a full width operation: out.iw = in1.iw + in2.iw and out.qw = in1.qw + in2.qw

Parameters and Ports

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 * in2)

Module sfp​_mult​_ind

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Multiplication of sfp signals followed by resizing (equivalant to sfp_mult_full + sfp_resize_ind)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 * in2)

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module sfp​_resize

This design unit is implemented in fp​_resize.sv

This file depends on: fp_if.sv, clip.sv

Description

Change the # of int/frac bits of a sfp signal (without a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal

Instantiations

Module sfp​_resize​_ind

This design unit is implemented in fp​_resize.sv

This file depends on: fp_if.sv, clip.sv

Description

Change the # of int/frac bits of a sfp signal (with a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal

clipping output wire logic

clipping indicator (active-high)

Module sfp​_sub

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Subtraction of sfp signals followed by resizing (equivalant to sfp_sub_full + sfp_resize)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 - in2)

Instantiations

Module sfp​_sub​_full

This design unit is implemented in fp​_op​_full.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Subtraction of sfp signals with full precision. Output must have the correct iw/qw for a full width operation: out.iw = max(in1.iw, in2.iw) + 1 and out.qw = max(in1.qw, in2.qw)

Parameters and Ports

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 - in2)

Instantiations

Module sfp​_sub​_ind

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Subtraction of sfp signals followed by resizing (equivalant to sfp_sub_full + sfp_resize_ind)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout sfp.in

input sfp signal

in2 inout sfp.in

input sfp signal

out inout sfp.out

output sfp signal (= in1 - in2)

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module sfp​_to​_ufp

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a sfp to a resized ufp (without a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout sfp.in

input sfp signal

out inout ufp.out

output ufp signal

Instantiations

Module sfp​_to​_ufp​_full

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a sfp to a ufp: if clip = 1, clips negative numbers then drop the sign sign bit. if clip = 0, simply drops the sign bit. Output must have the same qw and one less iw than the input.

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout sfp.in

input sfp signal

out inout ufp.out

output ufp signal

clipping output wire logic

clipping indicator (active-high)

Module sfp​_to​_ufp​_ind

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a sfp to a resized ufp (with a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout sfp.in

input sfp signal

out inout ufp.out

output ufp signal

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module ufp​_add

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Addition of ufp signals followed by resizing (equivalant to ufp_add_full + ufp_resize)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal (= in1 + in2)

Instantiations

Module ufp​_add​_full

This design unit is implemented in fp​_op​_full.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Addition of ufp signals with full precision. Output must have the correct iw/qw for a full width operation: out.iw = max(in1.iw, in2.iw) + 1 and out.qw = max(in1.qw, in2.qw)

Parameters and Ports

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal (= in1 + in2)

Instantiations

Module ufp​_add​_ind

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Addition of ufp signals followed by resizing (equivalant to ufp_add_full + ufp_resize_ind)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal (= in1 + in2)

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module ufp​_mult

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Multiplication of ufp signals followed by resizing (equivalant to ufp_mult_full + ufp_resize)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal (= in1 * in2)

Instantiations

Module ufp​_mult​_full

This design unit is implemented in fp​_op​_full.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Multiplication of ufp signals with full precision. Output must have the correct iw/qw for a full width operation: out.iw = in1.iw + in2.iw and out.qw = in1.qw + in2.qw

Parameters and Ports

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal (= in1 * in2)

Module ufp​_mult​_ind

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Multiplication of ufp signals followed by resizing (equivalant to ufp_mult_full + ufp_resize_ind)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal (= in1 * in2)

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module ufp​_resize

This design unit is implemented in fp​_resize.sv

This file depends on: fp_if.sv, clip.sv

Description

Change the # of int/frac bits of a ufp signal (without a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout ufp.in

input ufp signal

out inout ufp.out

output ufp signal

Instantiations

Module ufp​_resize​_ind

This design unit is implemented in fp​_resize.sv

This file depends on: fp_if.sv, clip.sv

Description

Change the # of int/frac bits of a ufp signal (with a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout ufp.in

input ufp signal

out inout ufp.out

input ufp signal

clipping output wire logic

clipping indicator (active-high)

Module ufp​_sub

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Subtraction of ufp signals followed by resizing (equivalant to ufp_sub_full + sfp_resize)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout sfp.out

output sfp signal (= in1 - in2)

Instantiations

Module ufp​_sub​_full

This design unit is implemented in fp​_op​_full.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Subtraction of ufp signals with full precision. Output must have the correct iw/qw for a full width operation: out.iw = max(in1.iw, in2.iw) + 1 and out.qw = max(in1.qw, in2.qw)

Parameters and Ports

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout sfp.out

output sfp signal (= in1 - in2)

Instantiations

Module ufp​_sub​_ind

This design unit is implemented in fp​_op.sv

This file depends on: fp_resize.sv, fp_if.sv, fp_op_full.sv

Description

Subtraction of ufp signals followed by resizing (equivalant to ufp_sub_full + sfp_resize_ind)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in1 inout ufp.in

input ufp signal

in2 inout ufp.in

input ufp signal

out inout sfp.out

output sfp signal (= in1 - in2)

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module ufp​_to​_sfp

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a ufp to a resized sfp (without a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 0

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout ufp.in

input ufp signal

out inout sfp.out

output sfp signal

Instantiations

Module ufp​_to​_sfp​_full

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a ufp to an sfp by padding a 0 at the MSP as the sign bit. Output must have the same qw and one more iw than the input

Parameters and Ports

Ports

Name Direction Type Description
in inout ufp.in

input ufp signal

out inout sfp.out

output sfp signal

Module ufp​_to​_sfp​_ind

This design unit is implemented in fp​_convert.sv

This file depends on: fp_resize.sv, fp_if.sv

Description

Convert a ufp to a resized sfp (with a clipping indicator)

Parameters and Ports

Parameters

Name Type Default Value Description
clip 1

(if reducing iw) 0 = wrap, 1 = clip

Ports

Name Direction Type Description
in inout ufp.in

input ufp signal

out inout sfp.out

output sfp signal

clipping output wire logic

clipping indicator (active-high)

Instantiations

Module clip​_signed

This design unit is implemented in clip.sv

Description

Reduce word length of the signed integer input, clipping values higher/lower than the output word length can fit.

Parameters and Ports

Parameters

Name Type Default Value Description
inw 0

input word length

outw 0

output word length

Ports

Name Direction Type Description
in input wire signed logic [inw-1:0]

input

out output wire signed logic [outw-1:0]

clipped output

clipping output wire logic

clipping indicator (active-high)

Module clip​_unsigned

This design unit is implemented in clip.sv

Description

Reduce word length of the unsigned integer input, clipping values higher/lower than the output word length can fit.

Parameters and Ports

Parameters

Name Type Default Value Description
inw 0

input word length

outw 0

output word length

Ports

Name Direction Type Description
in input wire logic [inw-1:0]

input

out output wire logic [outw-1:0]

clipped output

clipping output wire logic

clipping indicator (active-high)