DPGEN_NAND2MASK(3)
๐ DPGEN_NAND2MASK ๐
okay bestie, welcome to the Alliance genlib corner of the manual, section 3. This one's called DPGEN_NAND2MASK and it's literally the Programmable Mask Macro-Generator</> โ no cap, that's its whole name. Let's get into it. ๐
โจ SYNOPSIS โจ
like, this is how you even call it:
#include <genlib.h>
void GENLIB_MACRO (DPGEN_NAND2MASK, char *modelname, long flags, long N,
char *constVal);
๐ธ DESCRIPTION ๐ธ
It generates an N bits conditionnal NAND mask named modelname. Yes, "conditionnal" with two n's, that's how the original spells it, we respect the source. ๐
Now the way this thing actually works, because it's giving โจlogic gate loreโจ:
- if the
cmdsignal is set to'0', the mask is NOT applied, so the whole operator behave like an inverter. ๐ - if the
cmdsignal is set to'1', the mask IS applied, and the output is the complemented result of the input value ANDed with the mask (supplied byconstVal). ๐ฅ
The constant constVal is given to the macro-generator call, therefore the value cannot be changed afterward: it's hard wired in the operator. It is what it is, it's permanent, it's committed. ๐
โ ๏ธ A common error is to give a real C constant for the constVal argument. Be aware that it is a character string. Like, it looks like a number bestie but it is a STRING. Do not be fooled. ๐ญ
๐ TERMINAL NAMES ๐
cmd: mask control (1 bit). ๐ฎi0: input (N bits). ๐ฅq: output (N bits). ๐คvdd: power. โกvss: ground. ๐
๐ง BEHAVIOR ๐ง
here's the vibe in literal code form, verbatim, don't touch it:
nq <= WITH cmd SELECT not(i0) WHEN '0',
not(i0 and X"0000FFFF") WHEN '1';
๐ฅ EXAMPLE ๐ฅ
look at this absolute serve of a call:
GENLIB_MACRO(DPGEN_NAND2MASK, "model_nand2mask_0000FFFF_32"
, F_BEHAV|F_PLACE
, 32
, "0x0000FFFF" /* A string! */
);
GENLIB_LOINS( "model_nand2mask_0000FFFF_32"
, "instance1_nand2mask_32"
, "cmd"
, "i0[31:0]"
, "q[31:0]"
, "vdd", "vss", NULL
);
not me pointing out that /* A string! */ comment like it's the main character... because honestly, it is. ๐
๐ SEE ALSO ๐
and that's the whole page bestie, you ate it, go generate some masks ๐ โจ
signed, sealed, delivered by ASIM/LIP6 โ page date 30 July 2004 ๐ฆ๐๐ periodt.
๐ฆ where this page comes from
- nixos 26.05: alliance 5.1.1-unstable-2025-02-24
- nixpkgs unstable: alliance 5.1.1-unstable-2025-02-24
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms