DPGEN_RF1(3)
π DPGEN_RF1 π
okay bestie, so this one's a page from the Alliance - genlib User's Manual, and it's about a little macro-generator called DPGEN_RF1 (and its moody twin DPGEN_RF1R0). Sit down, grab a boba, we're building register files. π«Ά
β¨ NAME β¨
DPGEN_RF1, DPGEN_RF1R0 β the Register File Macro-Generator. that's it, that's the whole name section, slay. π
β¨ SYNOPSIS β¨
#include <genlib.h>
void GENLIB_MACRO (DPGEN_RF1, char *modelname, long flags, long N);
void GENLIB_MACRO (DPGEN_RF1R0, char *modelname, long flags, long N);
two macros, same shape, different energy. π¦
β¨ DESCRIPTION β¨
so what it does is generate a register file of regNumber words of N bits, no decoder, and it names it modelname. iconic, honestly. π
now here's the plot twist: the DPGEN_RF1R0 variant differs from DPGEN_RF1 in that the register of address zero is stuck to zero. like, permanently. you can write into it β go ahead, try β it will not change the value. and when you read it? it will always return zero. the register equivalent of "no thoughts, head empty." π
How it works : (aka the lore π§)
datain0anddatain1: the two write busses. only one of them is used to actually write the register word, and which one it is gets picked by theselsignal.sel: when it's set to'0',datain0is used to write the register word, otherwise it'll bedatain1.selr,selw: this register file has no decoder, soselrhas a bus width equal toregNumber. one bit for each word. one. bit. per. word. periodt.
β¨ TERMINAL NAMES β¨
the cast of characters, in order, no notes: π
ckok: clock signal (input, 1 bit).sel: select the write bus (input, 1 bit).selr: the decoded read address (input,regNumberbits).selw: the decoded write address (input,regNumberbits).datain0: first write bus (input,Nbits).datain1: second write bus (input,Nbits).dataout: read bus (output,Nbits).vdd: power.vss: ground.
β¨ EXAMPLE β¨
here's the moment you've been waiting for, bestie, the actual code, copy it exactly, no cap: π₯
GENLIB_MACRO(DPGEN_RF1, "model_rf1x8_32"
, F_BEHAV|F_PLACE
, 32 /* Words size. */
, 8 /* Number of words. */
);
GENLIB_LOINS( "model_rf1x8_32"
, "instance1_rf1_32"
, "ckok"
, "sel"
, "selr[7:0]"
, "selw[7:0]"
, "datain0[31:0]"
, "datain1[31:0]"
, "dataout[31:0]"
, "vdd", "vss", NULL
);
look at those bus slices. selr[7:0], selw[7:0], datain0[31:0], datain1[31:0], dataout[31:0]. she's gorgeous. π
β¨ SEE ALSO β¨
go read those too, iykyk. π
lowkey reminder bestie: DPGEN_RF1R0's address-zero register is stuck at zero forever. you can write to it, it just will not care. that's not a bug, that's a feature, and that's the whole point of the R0 variant. π«‘
and that's the whole page!! brought to you by ASIM/LIP6, dated 30 July 2004 β yeah she's vintage, she's an icon, she's been serving since '04 and still ate. πβ¨ no notes, mwah. π
π¦ 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