DPGEN_CONST(3)
π DPGEN_CONST β the constant macro-generator, bestie π
okay so this is a page from the Alliance - genlib User's Manual, it lives in section 3 of the manual (that's the (3) in DPGEN_CONST(3), iykyk), and it's literally all about generating constant macros. no cap. let's get into it π«Ά
β¨ NAME β¨
DPGEN_CONST β Constant Macro-Generator π
πΈ SYNOPSIS πΈ
#include <genlib.h>
void GENLIB_MACRO (DPGEN_CONST, char *modelname, long flags, long N,
char *constVal0);
like, that's the whole vibe. #include <genlib.h> and then you call GENLIB_MACRO with DPGEN_CONST as the first thing. periodt π
π¦ DESCRIPTION π¦
So basically: generate a N bits constant named modelname. that's it, that's the function. iconic behaviour honestly β¨
π TERMINAL NAMES π
here's the whole cast of characters, in order, no skips:
q: the constant (output,Nbit). βvdd: power. β‘vss: ground. π
π BEHAVIOR π
the actual behaviour is this lil line:
q <= constVal;
not me being obsessed with how simple that is π
π₯ EXAMPLE π₯
here's how you'd actually use it, bestie β watch the formatting:
GENLIB_MACRO(DPGEN_CONST, "model_const_0xFFFF0000"
, F_BEHAV|F_PLACE
, 4
, "0xFFFF0000" /* A string! */
);
GENLIB_LOINS( "model_const_0xFFFF0000"
, "instance1_const_0xFFFF0000"
, "q[31:0]"
, "vdd", "vss", NULL
);
ok real talk β that/* A string! */comment is doing the lord's work because"0xFFFF0000"is a string, not a number. do not come for me, just read the comment. π
π SEE ALSO π
and that's the tea π this whole page is from ASIM/LIP6, dated 30 July 2004 β vintage but still slaying, fr fr. go build something cute with it ππ§
π¦ 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