On the tasks page, you refactored three pasted stimulus blocks into one routine. The arithmetic was simple: ten copies mean ten places for a bug. The problem generalizes beyond one block. Real projects paste definitions across modules and files; copies drift, and two parts of a testbench begin to disagree about one fact. This file has already drifted: two modules contain two pasted copies of one function, and one has quietly changed.
A package is a named container outside any module. It holds shared definitions, constants, types, and routines, including the functions from Page 15, declared exactly once. It is not hardware and it is not a testbench; it is a shelf. Put a definition on the shelf once, and every module that needs it takes it from the shelf instead of keeping a private copy. Drift becomes structurally impossible: a definition that exists once cannot disagree with itself.
A module reaches the shelf through an import, either wildcard ::* or explicit. Two scoping rules bite in this lab.
Declare before use. In a single file, the package must appear above the modules that import it.
Local wins. If a module still has a local definition of a name, it silently shadows the imported one. A package plus an import is not enough; you must delete the local copies. The import becomes the only source of truth only when nothing local remains to outvote it.
Packages are not tidiness. The starter prints the wrong checksum today because two pasted copies drifted, exactly as real projects drift. You could patch the broken copy in place, and it would look right until the next drift. Or you can remove the possibility: one definition, one shelf, imported everywhere. The fix is not a patched bug; it is an eliminated class of bug. Organization is correctness with a memory.
This file has alpha_unit and beta_unit, each with its own pasted copy of checksum8. The copies have drifted: beta's copy is buggy, so its wrong checksum on the first run is intended, not a platform fault. Create package chk_pkg at the top of the file, move one correct copy of the function into it, import the package in both modules, and delete both local copies so the package is the only place the function exists. Keep both print lines unchanged. Run and submit. The engine checks both printed checksums and the structure; fixing beta in place will not pass.
chk_pkg at very top of file. (2) Import: add import of chk_pkg inside each module, before function used. (3) Delete: remove both local copies — local definition silently outvotes import; shelf only becomes source of truth when nothing local remains.Weekly intelligence on VLSI, AI for EDA, and chip careers. 20,000+ engineers already inside.