DPGEN_SHIFT(3)

πŸ“¦ version 5.1.1-unstable-2025-02, in nixos 26.05, nixpkgs unstable

πŸ’… DPGEN_SHIFT β€” the shifter macro-generator bestie ✨

okay so this is a page from the Alliance - genlib User's Manual, and it's all about DPGEN_SHIFT, the Shifter Macro-Generator. yes queen, we're generating shifters today πŸŽ€


✨ NAME ✨

DPGEN_SHIFT β€” Shifter Macro-Generator πŸ¦‹


🌸 SYNOPSIS 🌸

#include  <genlib.h>

void GENLIB_MACRO (DPGEN_SHIFT, char *modelname, long flags, long N);

πŸ’– DESCRIPTION πŸ’–

bestie, this literally generates a shifter with N bits and names it modelname. that's the whole vibe ✨

how it works (the lore 🧚):

  • if the op[0] signal is set to '1' it performs a right shift, and performs a left shift otherwise. no in-between, it's giving binary πŸ’…
  • if the op[1] signal is set to '1' it performs an arithmetic shift (and lowkey this one is only meaningful in case of a right shift, so don't come for me).
  • shamt : specifies the shift amount. the width of this signal (Y) is computed from the operator's width like this: Y = ceil(log2(N)) - 1. math ate, periodt πŸ’―

🫢 TERMINAL NAMES 🫢

  1. op : select the kind of shift (input, 2 bit).
  2. shamt : the shift amount (input, Y bits).
  3. i : value to shift (input, N bits).
  4. o : output (N bits).
  5. vdd : power.
  6. vss : ground.

🌈 EXAMPLE 🌈

GENLIB_MACRO(DPGEN_SHIFT, "model_shift_32",
                          F_BEHAV|F_PLACE,
                          32);

GENLIB_LOINS("model_shift_32",
             "instance1_shift_32",
             "op[1:0]",
             "shamt[4:0]",
             "x[31:0]",
             "y[31:0]",
             "vdd", "vss", NULL);

look at her go 😭 iconic behavior fr fr πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

GENLIB_MACRO(3), genlib(1)


ngl if you got all the way here you're the main character of this manpage πŸ’– go shift some bits bestie, iykyk 🌟

this whole thing comes courtesy of ASIM/LIP6, dated 30 July 2004 β€” vintage but still slaying πŸ’… πŸŽ€

πŸ“¦ where this page comes from