DPGEN_ADSB2F(3)
π DPGEN_ADSB2F β Adder/Substractor Macro-Generator π
okay bestie, so this is a page from the Alliance - genlib User's Manual and it's literally the glow-up guide for one little macro-generator. it makes an adder. it also makes a substractor. it's giving both. let's get into it π¦
β¨ NAME β¨
DPGEN_ADSB2F β the Adder/Substractor Macro-Generator, no cap.
β¨ SYNOPSIS β¨
#include <genlib.h>
void GENLIB_MACRO (DPGEN_ADSB2F, char *modelname, long flags, long N);
β¨ DESCRIPTION β¨
So basically it generates an N bits adder/substractor named modelname. that's the whole job. iconic of it honestly. π
How it works (the tea β):
- if the
add_subsignal is set to'0'an addition is performed, otherwise it's a substraction. one bit decides your whole destiny fr fr. - Operation can be either signed or unsigned. In unsigned mode
c31is the overflow, in unsigned mode you have to compute overflow by XORingc31andc30. yes bestie, read that again, that's exactly what it says. π
πΈ TERMINAL NAMES πΈ
the terminals, in order, so you don't have to guess which one is which. main character lineup energy π
add_sub: select addition or substraction (input, 1 bit).c31: carry out. In unsigned mode, this is the overflow (output, 1 bits).c30: used to compute overflow in signed mode : overflow :=c31 xor c30(output, 1 bits).i1: first operand (input, N bits).i0: second operand (input, N bits).q: output (N bits).vdd: power.vss: ground.
π EXAMPLE π
look at her go, an actual 32-bit one π:
GENLIB_MACRO(DPGEN_ADSB2F, "model_adsb2f_32"
, F_BEHAV|F_PLACE
, 32
);
GENLIB_LOINS( "model_adsb2f_32"
, "instance1_adsb2f_32"
, "add_sub"
, "c32"
, "c31"
, "i1[31:0]"
, "i0[31:0]"
, "q[31:0]"
, "vdd", "vss", NULL
);
not me noticing that"c32"in there, the macro only ever told you aboutc31andc30... I'm just saying what I see bestie, the example is the example π
π SEE ALSO π
and that's the whole page, you ate it π if you wanna know who wrote this down: it's the fine folks at ASIM/LIP6, and this little baddie is dated 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