DPGEN_NUL(3)

πŸ“¦ version 5.1.1, in fedora 43, fedora 44

✨ DPGEN_NUL ✨ β€” the Zero Detector Macro-Generator, bestie edition

okay so this page is straight out of the Alliance - genlib User's Manual, and today we're learning about DPGEN_NUL, aka the girl who checks if literally everything is zero. she's a macro-generator, she's iconic, she does one job and she does it flawlessly. let's get into it πŸ’…


🌸 NAME 🌸

DPGEN_NUL β€” Zero Detector Macro-Generator. that's it, that's the whole vibe. she looks at a pile of bits and tells you if they're all zeros. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#include  <genlib.h>

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

that's the whole incantation, bestie. include the header, call the macro, boom β€” you got yourself a zero detector.


πŸ¦‹ DESCRIPTION πŸ¦‹

Generate a N bits zero detector named modelname. N bits go in, one lil flag comes out, and that flag is screaming "yes queen, it's ALL zeros" or "nope, something's not zero in here." 🫢

🌈 TERMINAL NAMES 🌈

the ports, in order, so you know exactly who's who at this sleepover:

  1. i0 : value to check (input, N bits). the thing under investigation.
  2. q : null flag (output, 1 bit). the verdict. the moment of truth.
  3. vdd : power. she needs her electrolytes. ⚑
  4. vss : ground. the calm, grounded friend in every group chat.

πŸ’– BEHAVIOR πŸ’–

here's the actual logic, and we're keeping it character for character because it's sacred:

q <= <= '1' WHEN (i0 = X"00000000") ELSE '0';

so like β€” if i0 equals all those zeros, q goes '1'. otherwise '0'. simple. clean. chef's kiss. 😘


πŸ”₯ EXAMPLE πŸ”₯

first you generate the macro, then you instantiate it. two steps, both slay:

GENLIB_MACRO(DPGEN_NUL, "model_nul_32"
                      , F_BEHAV|F_PLACE
                      , 32
                      );

GENLIB_LOINS( "model_nul_32"
            , "instance1_nul_32"
            , "i0[31:0]"
            , "q"  /* Flag null. */
            , "vdd", "vss", NULL
            );

see how the second one wires i0[31:0] in, catches q on the way out (she's the null flag, obviously πŸ’), and gets hooked up to vdd and vss? that's the whole ritual. 32 bits of checking, one bit of truth. periodt.

heads up bestie: F_BEHAV|F_PLACE is doing heavy lifting in that first call, and N is 32 here β€” change N and you change how many bits get checked, but the i0/q/vdd/vss lineup stays the same.

πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, iykyk. πŸ“š


written under the ASIM/LIP6 banner, dated 30 July 2004 β€” yeah she's an elder but she still ate, and the manual page still hits. mwah πŸ’‹βœ¨πŸ¦‹