Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
3c17db5ceThis file is pinned to the selected release. Download the original to open it in your design tool.
import "comb.fil";
extern "signed.sv" {
comp Neg[WIDTH]<'G: 'L-('G), ?'L: 1='G+1>(
in: ['G, 'L] WIDTH
) -> (
out: ['G, 'L] WIDTH
) where 'L > 'G, WIDTH > 0;
}
comp SignedConst[WIDTH, VALUE, ?D=1]<'G: D>() -> (
out: ['G, 'G+D] WIDTH,
) where
WIDTH > 0,
D > 0
{
if VALUE >= pow2(WIDTH-1) {
c := new Const[WIDTH, pow2(WIDTH) - VALUE]<'G, 'G+D>();
negc := new Neg[WIDTH]<'G, 'G+D>(c.out);
out = negc.out;
} else {
posc := new Const[WIDTH, VALUE]<'G, 'G+D>();
out = posc.out;
}
}