Loading files
7aa19ccf2This file is pinned to the selected release. Download the original to open it in your design tool.
import "primitives/core.fil";
// extra components to make things simpler to write
extern "extras.sv" {
comp OneHotMux[WIDTH]<'G:'L-('G), ?'L:1='G+1>(
sel: ['G, 'L] 8,
in0: ['G, 'L] WIDTH,
in1: ['G, 'L] WIDTH,
in2: ['G, 'L] WIDTH,
in3: ['G, 'L] WIDTH,
in4: ['G, 'L] WIDTH,
in5: ['G, 'L] WIDTH,
in6: ['G, 'L] WIDTH,
in7: ['G, 'L] WIDTH
) -> (
out: ['G, 'L] WIDTH
) where 'L > 'G, WIDTH > 0;
}
comp RightShifter[WIDTH]<'G:1>(
in: ['G, 'G+1] WIDTH,
shamt: ['G, 'G+1] WIDTH,
isArith: ['G, 'G+1] 1
) -> (
out: ['G, 'G+1] WIDTH
) where WIDTH > 0 {
sra := new ArithShiftRight[WIDTH]<'G>(in, shamt);
srl := new ShiftRight[WIDTH]<'G>(in, shamt);
mux := new Mux[WIDTH]<'G>(isArith, sra.out, srl.out);
out = mux.out;
}