### Check ASLRef version Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Verifies the installation by printing the ASLRef version. The output shown is an example. ```bash $ aslref --version aslref version 7.56+03 rev 7aa9d1f3cee2598ec64f14372f210e008ac5510f ``` -------------------------------- ### Build and install ASLRef from source Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Builds and installs ASLRef into the specified PREFIX directory. ```bash $ make build-aslref $ make install-aslref PREFIX=$PREFIX ``` -------------------------------- ### Compile and install herd7 from source Source: https://github.com/herd/herdtools7/blob/master/catalogue/bpf/README.md Builds and installs herd7 to /usr/local using make. Requires sudo for the install step. Run from the root directory of herdtools7. ```shell make PREFIX=/usr/local ``` ```shell sudo make PREFIX=/usr/local install ``` -------------------------------- ### Install ASLRef dependencies Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Builds the opam package file and installs its dependencies. ```bash $ cd herdtools7 $ dune build asllib/aslref.opam $ opam install ./asllib --deps-only ``` -------------------------------- ### Build the system Source: https://github.com/herd/herdtools7/blob/master/herd-www/README.md Compile the project using make, which installs the system into the www sub-directory. ```bash % make ``` -------------------------------- ### Example hardware requirement file req.txt Source: https://github.com/herd/herdtools7/blob/master/tools/uoaim/README.md Example content for a hardware requirement file named 'req.txt'. It uses the optional prefix and the first conclusion format, with a premise listing three conditions. ```text This places a requirement on the hardware that if all of the following apply: * the Implicit Instruction Memory Read Effect (c) appears in program order before the Implicit Instruction Memory Read Effect (d). * Effect (d) is IC-before the IC Effect (m). * the DSB FULL Effect (n) appears in program order between Effect (m) and the Explicit Memory Write Effect (b). then Effect (c) is not architecturally Allowed to Read-from Effect (b). ``` -------------------------------- ### Example: Transform Parser.cmly to out.cf Source: https://github.com/herd/herdtools7/blob/master/asllib/menhir2bnfc/README.md Example usage that converts Parser.cmly into out.cf. Run from the asllib/menhir2bnfc directory after building. ```text ./menhir2bnfc.exe Parser.cmly out.cf ``` -------------------------------- ### diyone7 command example Source: https://github.com/herd/herdtools7/blob/master/gen/tests/README.md Example of a diyone7 command and its expected output format. The filename must match the generated AArch64 line for successful commands. ```text (* diyone7 -arch AArch64 -metadata false -oneloc PosRW Rfi *) AArch64 CoRW1+pos-rfi ... ``` -------------------------------- ### Install opam on MacOS Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Installs the opam package manager, a prerequisite for installing ASLRef. ```bash $ brew install opam ``` -------------------------------- ### Install herdtools7 via OPAM Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Installs the herdtools7 package using the OPAM package manager. Run this after installing OPAM. ```shell % opam install herdtools7 ``` -------------------------------- ### Install dependencies with opam Source: https://github.com/herd/herdtools7/blob/master/herd-www/README.md Use opam to resolve and install dependencies declared in herd-www.opam. ```bash % opam install . --deps-only ``` -------------------------------- ### AsBitvector conversion example output Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/SemanticsUtilities.tex Example from the SemanticsRule.AsBitvector.asl file showing the conversion of a signed integer into a bitvector, with the resulting bitvector and its integer representation. ```asl bv = 0xfdf0, bv_i = 0xfdf0 ``` -------------------------------- ### Install Pre-Commit with Homebrew (macOS) Source: https://github.com/herd/herdtools7/blob/master/README.md Installs Pre-Commit on macOS using Homebrew. Run this command before setting up pre-commit hooks. ```shell % brew install pre-commit ``` -------------------------------- ### Install dependencies with opam Source: https://github.com/herd/herdtools7/blob/master/asllib/aslspec/README.md Install the required OCaml packages for aslspec using opam. ```bash opam install dune menhir qcheck zarith re feat fix cmdliner logs ``` -------------------------------- ### Install ASLRef release version Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Installs the latest released version of ASLRef from opam. ```bash $ opam install aslref ``` -------------------------------- ### Install hevea via opam Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/README-HTML.md Commands to update opam, install the hevea package, and verify the installed version. ```bash % opam update % opam install hevea % hevea -version hevea 2.38 ... ``` -------------------------------- ### Install herdtools7 dependencies with opam Source: https://github.com/herd/herdtools7/blob/master/asllib/menhir2bnfc/README.md Run from the herdtools7 directory to install the project's dependencies via opam. Requires opam and the herdtools7 source. ```shell opam install . --deps-only ``` -------------------------------- ### Install qcheck for herdtools7 tests Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Installs the optional qcheck dependency via OPAM, required for running certain tests. ```shell % opam install qcheck ``` -------------------------------- ### Override prefetch metadata with -hints map.txt Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Example of using a hints file to change prefetch metadata, reversing the cache management scheme, then building and running the test. ```shell % cat map.txt 6.SB Prefetch=0:x=W,0:y=F,1:y=W,1:z=F,2:a=F,2:z=W,3:a=W,3:b=F,4:b=W,4:c=F,5:c=W,5:x=F ``` ```shell % litmus7 -mem indirect -preload custom -hints map.txt -o R 6.SB.litmus % cd R % make ... % ./6.SB.exe Test 6.SB Allowed Histogram (63 states) 24 *>0:EAX=0; 1:EAX=0; 2:EAX=0; 3:EAX=0; 4:EAX=0; 5:EAX=0; ... Prefetch=0:x=W,0:y=F,1:y=W,1:z=F,2:a=F,2:z=W,3:a=W,3:b=F,4:b=W,4:c=F,5:c=W,5:x=F ... ``` -------------------------------- ### Build dictionary with build-dict.sh Source: https://github.com/herd/herdtools7/blob/master/tools/uoaim/README.md Runs the build-dict.sh script and redirects its output to dict.ml. Requires pandoc to be installed. ```sh ./build-dict.sh > dict.ml ``` -------------------------------- ### Install Pre-Commit with pip (all OS) Source: https://github.com/herd/herdtools7/blob/master/README.md Installs Pre-Commit on all other operating systems (including macOS without Homebrew) using Python's pip. ```shell % pip install pre-commit ``` -------------------------------- ### Using generated render commands Source: https://github.com/herd/herdtools7/blob/master/asllib/aslspec/aslspec.md Example of using the generated \Render... commands in a .tex file that has loaded the generated macros. ```latex \RenderType{expr} \RenderTypes[remove_hypertargets]{expr_literal} \RenderConstant{empty_tenv} \RenderRelation{annotate_expr} \RenderRule{annotate_expr_ELit} \RenderProse{annotate_expr_ELit} ``` -------------------------------- ### Example execution output Source: https://github.com/herd/herdtools7/blob/master/asllib/carpenter/README.md Shows the expected output format when executing a generated test file, including a type error about control flow paths. ```text // results for file: ../../tmp/2026-06-05T10:23:11-0006.asl Error: File ../../tmp/2026-06-05T10:23:11-0006.asl, line 7, characters 2 to 35: var rwqhgkjdozr: boolean = FALSE; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ASL Type error: not all control flow paths of the function "main" are guaranteed to either return, raise an exception, or invoke unreachable. // end of results for file: ../../tmp/2026-06-05T10:23:11-0006.asl ``` -------------------------------- ### diycross7 -name and -num example Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Shows the diycross7 command with -name and -num options to generate tests with custom names and numeric suffixes, producing MP+X000 and MP+X001. ```shell % diycross7 -name MP+X -num true LwSyncdWW Rfe [DpAddrdR,PodRR],[DpAddrdW,PodWR] Fre Generator produced 2 tests ``` -------------------------------- ### Run kernel module test with parameters (avail, size, nruns) Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Example command to run a kernel module test with parameters set via key-value interface. The output shows the test results, including histogram, witnesses, and observation. Note that parameter values must be strict integers; generalized syntax like '10k' is not accepted, and only positive or null values are allowed except for affinity. ```shell % sudo sh run.sh avail=2 size=100 nruns=1 Mon Aug 21 11:04:12 CEST 2017 Compilation command: klitmus7 -o /tmp/X.tar SB+onces.litmus OPT=avail=2 size=100 nruns=1 uname -r=3.13.0-108-generic Test SB+onces Allowed Histogram (3 states) 12 *>0:r0=0; 1:r0=0; 48 :>0:r0=1; 1:r0=0; 40 :>0:r0=0; 1:r0=1; Ok Witnesses Positive: 12, Negative: 88 Condition exists (0:r0=0 /\ 1:r0=0) is validated Hash=2487db0f8d32aeb7ec0eacf5d0e301d7 Observation SB+onces Sometimes 12 88 Time SB+onces 0.00 Mon Aug 21 11:04:12 CEST 2017 ``` -------------------------------- ### Create OPAM switch for herdtools7 Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Creates an empty OPAM switch named 'herdtools7' and configures the environment for it. This prepares the switch before installing project dependencies. ```shell % opam switch create herdtools7 --empty % eval $(opam config env --switch=herdtool7 --set-switch) % opam install . --deps-only ``` -------------------------------- ### ReadFromBitvector example output Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/SemanticsUtilities.tex Example from the SemanticsRule.ReadFromBitvector.asl file showing the result of reading from a bitvector: an empty slice and a non-empty slice with their integer counterparts. ```asl empty_bv_slice = 0x, empty_i_slice = 0x slice_bv = 0x9c5, slice_i = 0x9c5 ``` -------------------------------- ### CaseStatement.discriminant example (output) Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/Statements.tex Expected console output when evaluating the CaseStatement.discriminant example. Shows the selected case for discriminant x=51. ```text num_tests: 0 selected case x=51 ``` -------------------------------- ### Install herdtools7 with custom PREFIX Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Installs herdtools7 tools to PREFIX/bin and data files to PREFIX/share/herdtools7. Overrides the default PREFIX ($HOME) by defining it on the make command line. ```shell % make PREFIX="$HOME/.local/" install ``` -------------------------------- ### CaseStatement.otherwise example (output) Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/Statements.tex Expected console output when evaluating the CaseStatement.otherwise example. Shows the 'otherwise' alternative is executed. ```text num_tests: 0 selected otherwise ``` -------------------------------- ### uoaim7 --hwreq command Source: https://github.com/herd/herdtools7/blob/master/tools/uoaim/README.md Runs uoaim7 with the --hwreq flag on the example file, producing an 'empty' test output. ```sh $ uoaim7 --hwreq req.txt empty [Imp & Instr & R]; rf^-1 & (po; [Imp & Instr & R]; IC-after; [IC]; po; [dsb.full]; po); [Exp & W] ``` -------------------------------- ### diyone7 CtrldR Fre SyncdWW Rfe - PPC A control dependency example Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Example of a control dependency relaxation using the diyone7 tool. The command specifies CtrldR, Fre, SyncdWW, and Rfe. The PPC A test includes two processors with load, compare, branch, isync, and store instructions. The exists clause checks for a specific outcome. The comment field shows DpCtrlIsyncR for CtrldR. ```text % diyone7 CtrldR Fre SyncdWW Rfe PPC A "DpCtrlIsyncdR Fre SyncdWW Rfe" { 0:r2=y; 0:r4=x; 1:r2=x; 1:r4=y; } P0 | P1 ; lwz r1,0(r2) | lwz r1,0(r2) ; cmpw r1,r1 | li r1,1 ; beq LC00 | stw r1,0(r2) ; LC00: | li r3,1 ; isync | stw r3,0(r4) ; lwz r3,0(r4) | ; exists (0:r1=1 /\ 0:r3=0) ``` ``` -------------------------------- ### OpenCL 2.0 scope inclusion example Source: https://github.com/herd/herdtools7/blob/master/catalogue/hrf/asplos14_hrf_updated.pdf Shows an OpenCL 2.0 example with two global atomic variables and operations using different memory scopes (device and work_group) to illustrate scope inclusion. The example is used to demonstrate that OpenCL 2.0 is an SC for HRF model when using memory_order_seq_cst. ```OpenCL C __global atomic A = {0}; __global atomic B = {0}; // __global means “not in a scratchpad” in OpenCL A.store(1, memory_order_seq_cst, memory_scope_device); B.load(memory_order_seq_cst, memory_scope_device); B.store(1, memory_order_seq_cst, memory_scope_work_group); A.load(memory_order_seq_cst, memory_scope_work_group); ``` -------------------------------- ### Build herdtools7 Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Builds the herdtools7 project using the default make target. Run from the project root after dependencies are installed. ```shell % make all ``` -------------------------------- ### Theme file header: LISA to AArch64 Source: https://github.com/herd/herdtools7/blob/master/doc/jingle.tex Specifies the source and target architectures at the start of a theme file. ```text LISA to AArch64 ``` -------------------------------- ### def-asl-subprogram-stdlib macro example for LowestSetBitNZ Source: https://github.com/herd/herdtools7/blob/master/acl2/asl/proofs/stdlib/README.md Example of the def-asl-subprogram-stdlib macro used to generate a theorem about the ASL function LowestSetBitNZ. The :error-cond specifies when the function errors, and :return-values specifies the expected return value. ```lisp (def-asl-subprogram-stdlib LowestSetBitNZ-correct :function "LowestSetBitNZ" :params (n) :args (x) :error-cond (equal x.val 0) :return-values ((v_int (bitops::trailing-0-count x.val))) :prepwork (...)) ``` -------------------------------- ### Update herdtools7 via OPAM Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Updates the OPAM package index and upgrades installed packages to the newest version. Run after the initial install to get the latest herdtools7. ```shell % opam update % opam upgrade ``` -------------------------------- ### Printing Literals Example Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/Statements.tex Shows the output of printing various literals, including integers, booleans, reals, bitvectors, and strings, as displayed in the console. Note that empty bitvectors are displayed as '0x'. ```text string_number_1 0 1000000 53170898287292728730499578000 TRUE FALSE 12345678900123456789/10000000000 0 hello\world "here I am " 0xd 0x LABEL_B ``` -------------------------------- ### Deploy the system Source: https://github.com/herd/herdtools7/blob/master/herd-www/README.md Copy the built www directory to a destination using rsync. ```bash % rsync -av www $HOME/public_html/diy ``` -------------------------------- ### Install Pre-Commit Git hooks Source: https://github.com/herd/herdtools7/blob/master/README.md Adds Pre-Commit to the local Git repository's pre-commit hooks so it runs automatically on git commit. Run from within the repository. ```shell % pre-commit install ``` -------------------------------- ### diycross7 -addnum false and true examples Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Shows the diycross7 command with -addnum false and true, demonstrating the duplicate name error and the generation of two tests with numeric suffixes. The output includes the generated test names. ```shell % diycross7 -addnum false LwSyncdWW Rfe [DpAddrdR,PodRR],[DpAddrdW,PodWR] Fre Fatal error: Duplicate name MP+lwsync+addr-po % diycross7 -addnum true LwSyncdWW Rfe [DpAddrdR,PodRR],[DpAddrdW,PodWR] Fre Generator produced 2 tests % cat @all # diycross7 -addnum true LwSyncdWW Rfe [DpAddrdR,PodRR],[DpAddrdW,PodWR] Fre MP+lwsync+addr-po.litmus MP+lwsync+addr-po001.litmus ``` -------------------------------- ### Build and run with -preload static Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Builds the test executable with static prefetch mode and runs it, showing the output with the Observation field. ```shell % mkdir -p S % litmus7 -mem indirect -preload static -o R 6.SB+Prefetch.litmus % make -C S % S/6.SB+Prefetch.exe Test 6.SB Allowed Histogram (63 states) 804 *>0:EAX=0; 1:EAX=0; 2:EAX=0; 3:EAX=0; 4:EAX=0; 5:EAX=0; ... Observation 804 999196 ... ``` -------------------------------- ### Build and run with -preload static1 and static2 Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Builds executables with static1 and static2 modes and shows their Observation outputs. ```shell % mkdir -p S1 S2 % litmus7 -mem indirect -preload static1 -o S1 6.SB+Prefetch.litmus % litmus7 -mem indirect -preload static2 -o S2 6.SB+Prefetch.litmus % make -C S1 && make -C S2 ... % S1/6.SB+Prefetch.exe | grep Observation Observation 6.SB Sometimes 1119 998881 % S2/6.SB+Prefetch.exe | grep Observation Observation 6.SB Sometimes 16 999984 ``` -------------------------------- ### C to LISA conversion example Source: https://github.com/herd/herdtools7/blob/master/doc/jingle.tex Shows a pattern matching a C if-else statement and converting it to LISA assembly instructions. Uses codevar: for arbitrary code and constvar: for constants. The conversion is recursive, applying the same rules to nested code. ```text C to LISA "if(x==constvar:c) codevar:t; else codevar:e;" -> "mov %test (eq %x &c); b[] %test then; codevar:e; b[] 1 end; then : codevar:t; end :" ``` -------------------------------- ### Run herdtools7 tests Source: https://github.com/herd/herdtools7/blob/master/INSTALL.md Runs the test suite, skipping tests that require unavailable optional dependencies. Works whether or not optional dependencies are installed. ```shell % make test ``` -------------------------------- ### Show genmodel.py help Source: https://github.com/herd/herdtools7/blob/master/catalogue/c11popl15/README.md Displays all available options for the genmodel.py script. ```bash $ ./genmodel.py --help ``` -------------------------------- ### diyone7 DpdW Rfe DpAddrdW Rfe - PPC A data dependency example Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Example of a data dependency relaxation using the diyone7 tool. The command specifies DpdW and DpAddrdW relaxations with Rfe. The PPC A test includes two processors with load, xor, li, and store instructions. The exists clause checks for a specific outcome. The comment field shows DpAddrdW instead of DpdW because DpdW is a macro for address dependency. ```text % diyone7 DpdW Rfe DpAddrdW Rfe PPC A "DpDatadW Rfe DpAddrdW Rfe" { 0:r2=y; 0:r4=x; 1:r2=x; 1:r5=y; } P0 | P1 ; lwz r1,0(r2) | lwz r1,0(r2) ; xor r3,r1,r1 | xor r3,r1,r1 ; li r4,1 | li r4,1 ; stw r3,0(r4) | stwx r4,r3,r5 ; exists (0:r1=1 /\ 1:r1=1) ``` ``` -------------------------------- ### Build ReadersGuide.pdf with make Source: https://github.com/herd/herdtools7/blob/master/readers-guide/README.md Run `make` in the readers-guide directory to build ReadersGuide.pdf. This runs pdflatex, bibtex, and pdflatex twice more, stopping on LaTeX errors and checking the log for missing-file diagnostics. ```sh make ``` -------------------------------- ### diy7 -conf x86-rfi.conf and x86-podwr.conf Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Runs diy7 with configuration files for testing Rfi and PodWR relaxations. The output shows the number of tests generated and the relaxations tested for each configuration. ```shell % cd rfi % diy7 -conf x86-rfi.conf Generator produced 38 tests Relaxations tested: {Rfi} % cd ../podwr % diy7 -conf x86-podwr.conf Generator produced 2 tests Relaxations tested: {PodWR} % cd .. ``` -------------------------------- ### Prefetch metadata in 6.SB+Prefetch.litmus Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Example of prefetch metadata in a litmus test source file, showing each thread flushing the location it stores to and touching each location it reads from. ```text Prefetch=0:x=F,0:y=T,1:y=F,1:z=T,2:z=F,2:a=T,3:a=F,3:b=T,4:b=F,4:c=T,5:c=F,5:x=T ``` -------------------------------- ### Binop rule with alternative outcomes Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/ASLFormal.tex The Binop rule as an example of a rule macro with multiple alternative outcomes (ThrowingConfig, DynErrorConfig, DivergingConfig). It shows the full rule with alternatives. ```ASL {, , } ( , ) (, ) ( , ) (, ) (, ) (, ) (, , ) ( , (, , ) ) ((, ), ) ``` -------------------------------- ### Topology configuration file x86_64.cfg Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Excerpt from the x86_64.cfg configuration file showing the standard Intel topology parameters, including smt=2. ```text ... # Standard Intel parameters smt=2 ... ``` -------------------------------- ### Use @file to list litmus sources for litmus7 Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Lists litmus sources in a file whose name starts with @, allowing multiple tests to be compiled at once. ```text $ cat @ppc SB-PPC.litmus STFW-PPC.litmus $ litmus7 -o /tmp/a.tar -os mac @ppc ``` -------------------------------- ### Constant initializer layout examples Source: https://github.com/herd/herdtools7/blob/master/asllib/aslspec/aslspec.md Two constant declarations showing valid and invalid math_layout for a tuple expression. The first uses a two-cell layout matching the pair; the second uses three cells and is invalid. ```asl constant c = (True, False) { math_layout = (_, _) }; ``` ```asl constant c = (True, False) { math_layout = (_, _, _) }; ``` -------------------------------- ### Generate HTML Reference Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/README-HTML.md Command to execute the build script and generate the HTML documentation in the HTML/ subdirectory. ```bash sh ./zyva.sh ``` -------------------------------- ### Output judgment layout example Source: https://github.com/herd/herdtools7/blob/master/asllib/aslspec/aslspec.md Shows a layout attached to an output judgment in a rule. The layout is checked against the rewritten transition judgment, not the raw output expression. ```asl -- (b, c) { (_, (_, _)) }; ``` -------------------------------- ### Evaluation order examples from EvaluationOrder.asl Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/Semantics.tex Output from running the EvaluationOrder.asl specification, showing the order of side-effects for function calls, tuples, non-short-circuiting binary operations, array-indexing, record construction, and print statements. ```text Function calls: 1234 Tuples: 12 Non-short-circuiting binary operations: 123 Array-indexing: 1 2 Record construction: 12 Print statements: 12341234 ``` -------------------------------- ### ReadFromBitvector: Reading From a Bitvector Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/SemanticsUtilities.tex The specification in ReadFromBitvector shows examples of reading slices from a bitvector and reading slices from an integer (first converted to a bitvector), followed by the output to the console. ```asl read_from_bitvector ``` -------------------------------- ### Prepare litmus7 run with kvm-aarch64 Source: https://github.com/herd/herdtools7/blob/master/catalogue/aarch64-faults/README.md Commands to create a litmus directory, generate tests with litmus7, build them, and run the test suite. ```shell % mkdir ${KUT_DIR}/litmus ``` ```shell % litmus7 -mach kvm-aarch64 -a 2 -kinds tests/kinds.txt -o ${KUT_DIR}/litmus tests/{3faults,LDRaf0F,STRdb0F,UDF,noUDF}.litmus ``` ```shell % cd ${KUT_DIR}/litmus ``` ```shell % make ``` ```shell % cd .. ``` ```shell % sh ./litmus/run.sh ``` -------------------------------- ### Store Immediate Instructions Source: https://github.com/herd/herdtools7/blob/master/catalogue/bpf/README.md Shows the syntax for storing immediate values to memory. All stores are fixed at 32-bits regardless of the size specified. ```bpf *(u8 *)(r0 + 0) = 23 *(u16 *)(r4 + 0) = -32 *(u32 *)(r5 + 0) = 44 *(u64 *)(r6 + 0) = 55 ``` -------------------------------- ### Run herd7 with apoil.cfg to display prop relation images Source: https://github.com/herd/herdtools7/blob/master/doc/herd.tex Two example invocations of herd7 using the apoil.cfg configuration file to display images in free mode. The first runs on IRIW+lwsyncs.litmus, the second on IRIW+syncs.litmus with the -through invalid option to ensure an image is produced. The -show prop and -doshow prop options instruct herd7 to produce images of executions that validate the final test condition and to display the 'prop' relation. ```shell % herd7 -conf apoil.cfg -show prop -doshow prop -gv IRIW+lwsyncs.litmus % herd7 -through invalid -conf apoil.cfg -show prop -doshow prop -gv IRIW+syncs.litmus ``` -------------------------------- ### Subprogram signatures where first parameter cannot be omitted Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/SubprogramCalls.tex These are example subprogram signatures where the first parameter cannot be omitted. The first signature `func ReplicateBit{N}(isZero: boolean) => bits(N)` shows a function with a parameter `N` and a boolean argument. The second `func Ones{N}() => bits(N)` shows a function with only a parameter and no arguments. ```latex func ReplicateBit{N}(isZero: boolean) => bits(N) func Ones{N}() => bits(N) ``` -------------------------------- ### Experiment with -pra and -prf options (flush stores) Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Command-line options to cancel default prefetch directives and enable cache touch for stores, showing the test outcome. ```shell % ./6.SB.exe -pra I -prf 0:x=W -prf 1:y=W -prf 2:z=W -prf 3:a=W -prf 4:b=W -prf 5:c=W Test 6.SB Allowed Histogram (63 states) ... Witnesses Positive: 0, Negative: 1000000 ... Prefetch=0:x=W,1:y=W,2:z=W,3:a=W,4:b=W,5:c=W ``` -------------------------------- ### Build herdtools7 and menhir2bnfc with make and dune Source: https://github.com/herd/herdtools7/blob/master/asllib/menhir2bnfc/README.md Run from the herdtools7 root directory. Builds herdtools7 with 'make all' and then builds the menhir2bnfc executable with dune. After this, a grammar.cf file should be produced at asllib/menhir2bnfc/grammar.cf. ```shell make all # build `herdtools7` ``` ```shell dune build asllib/menhir2bnfc # build `menhir2bnfc` ``` -------------------------------- ### QEMU command line for MP-TTD+DMB.ST+DSB-ISB Source: https://github.com/herd/herdtools7/blob/master/doc/kvm-log.txt Command line used to run the litmus test under QEMU/KVM with specific machine and device options. ```shell /usr/bin/qemu-system-aarch64 -nodefaults -machine virt,gic-version=host -accel kvm -cpu host -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd -device pci-testdev -display none -serial stdio -kernel M/./MP-TTD+DMB.ST+DSB-ISB.flat -smp 4 -append -q # -initrd /tmp/tmp.4oFrJTkv0a ``` -------------------------------- ### Race-free HRF-direct algorithm pseudocode Source: https://github.com/herd/herdtools7/blob/master/catalogue/hrf/asplos14_hrf_updated.pdf Pseudocode for a race-free HRF-direct algorithm that performs a stencil calculation on a shared grid. It uses work-group and device scope barriers to synchronize, ensuring race-free execution. The algorithm is presented as an example of applying HRF-direct to a high-performance heterogeneous application. ```text For t=0; t < nsteps; t+= group_step_size: group_step_size times do: BarrierSync(work-group scope) BarrierSync(device scope) ``` -------------------------------- ### QEMU command line for MP-TTD+DMB.ST+DMB.LD Source: https://github.com/herd/herdtools7/blob/master/doc/kvm-log.txt Command line used to run the litmus test under QEMU/KVM with specific machine and device options. ```shell /usr/bin/qemu-system-aarch64 -nodefaults -machine virt,gic-version=host -accel kvm -cpu host -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd -device pci-testdev -display none -serial stdio -kernel M/./MP-TTD+DMB.ST+DMB.LD.flat -smp 4 -append -q # -initrd /tmp/tmp.4oFrJTkv0a ``` -------------------------------- ### Build tests with diy7 Source: https://github.com/herd/herdtools7/blob/master/doc/x86.txt Builds the test suites (podwr, rfi, safe) using diy7 with their respective configuration files. Run from the project root. ```shell ( cd podwr && diy7 -conf x86-podwr.conf ) ( cd rfi && diy7 -conf x86-rfi.conf ) ( cd safe && diy7 -conf x86-safe.conf ) ``` -------------------------------- ### Conjunction example with distinct effect names Source: https://github.com/herd/herdtools7/blob/master/tools/uoaim/README.md Example of how to describe the expression (r1; r2) & (r3; r4) using distinct effect names for the middle effects. The tool assumes distinct names within a list of conjunctions. ```text * E1 is r1-before E3 * E3 is r2-before E2 * E1 is r3-before E4 * E4 is r4-before E2 ``` -------------------------------- ### Uninstall ASLRef release version Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Removes the ASLRef package installed via opam. ```bash $ opam remove aslref ``` -------------------------------- ### ConcatBitvectors: Concatenating Bitvectors Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/SemanticsUtilities.tex The specification in ConcatBitvectors/SemanticsRule.ConcatBitvectors.asl shows examples of concatenating the fields of a and of a. ```asl concat_bitvectors ``` -------------------------------- ### Run uoaim7 on pick_data_dep.txt Source: https://github.com/herd/herdtools7/blob/master/tools/uoaim/README.md Command to run uoaim7 on the pick_data_dep.txt file and the resulting cat expression. The output shows the synthesized let binding for pick-data-dep. ```sh $ uoaim7 --def pick_data_dep.txt let pick-data-dep = [Exp & R]; ~same-instance & (pick-basic-dep; [DATA]; (iico_data | iico_ctrl | (iico_data | iico_ctrl)+)); [Exp & W] ``` -------------------------------- ### Uninstall ASLRef from source Source: https://github.com/herd/herdtools7/blob/master/asllib/README.md Removes the ASLRef binaries installed from source using the provided make target. ```bash $ make uninstall-aslref PREFIX=$PREFIX ``` -------------------------------- ### Generate IRIW variations with data dependencies and lwsync using diycross7 Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Run diycross7 with -arch PPC and -name IRIW, passing lists of candidate relaxations (Rfe DpdR,LwSyncdRR Fre Rfe DpdR,LwSyncdRR Fre) to generate three tests. The output shows the generator produced 3 tests and lists the resulting files: @all, IRIW+addrs.litmus, IRIW+lwsync+addr.litmus, and IRIW+lwsyncs.litmus. ```shell % diycross7 -arch PPC -name IRIW Rfe DpdR,LwSyncdRR Fre Rfe DpdR,LwSyncdRR Fre Generator produced 3 tests % ls @all IRIW+addrs.litmus IRIW+lwsync+addr.litmus IRIW+lwsyncs.litmus ``` -------------------------------- ### Indexed judgment example Source: https://github.com/herd/herdtools7/blob/master/asllib/aslspec/aslspec.md Shows an indexed judgment that binds an index and a list variable for the body transition. ```asl INDEX(i, xs: step(xs[i]) -> ys[i]); ``` -------------------------------- ### Running with litmus7 - machine kvm-aarch64: mkdir, litmus7, make, run.sh Source: https://github.com/herd/herdtools7/blob/master/catalogue/aarch64-ETS2/README.md Commands to generate and build litmus tests for the KVM target. First create the 'litmus' directory under KUT_DIR, then generate tests with litmus7 using the kvm-aarch64 machine model and 2 threads, compile them with make, and finally execute the run.sh script. These steps are required for running VMSA tests that control translation tables and exception handlers. ```bash % mkdir ${KUT_DIR}/litmus ``` ```bash % litmus7 -mach kvm-aarch64 -a 2 -o ${KUT_DIR}/litmus -kinds tests/kinds.txt tests/@all ``` ```bash % cd ${KUT_DIR}/litmus ``` ```bash % make ``` ```bash % cd .. ``` ```bash % sh ./litmus/run.sh ``` -------------------------------- ### Subprogram signatures where the first parameter can be omitted Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/SubprogramCalls.tex Examples of subprogram signatures where the first parameter can be omitted, as used by can_omit_stdlib_param. ```latex func UInt{N: integer{1..128}} (x: bits(N)) => integer{0..2^N-1} func Len{N}(x: bits(N)) => integer {N} func ZeroExtend {N,M} (x: bits(M)) => bits(N) ``` -------------------------------- ### Compile 6.SB in user synchronisation mode with litmus7 Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Creates output directory R, compiles the 6.SB.litmus test with -barrier user and -vb true to enable timing information printing, then builds the test executable. ```shell % mkdir -p R % litmus7 -barrier user -vb true -o R 6.SB.litmus % cd R % make ``` -------------------------------- ### Rule with constant identifier: mov %r &c Source: https://github.com/herd/herdtools7/blob/master/doc/jingle.tex Translates a register load by a constant. Constants are identifiers starting with '&'. ```text "mov %r &c" -> "MOV %r,&c" ``` -------------------------------- ### Generate all IRIW variations using allRR keyword with diycross7 Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Run diycross7 with -arch PPC -name IRIW and use the special keyword allRR to specify all existing program order candidate relaxations between the 'R' and 'W' events. The command generates 28 tests, and the output lists the resulting files, including @all, IRIW.litmus, IRIW+addr+po.litmus, IRIW+lwsync+addr.litmus, and IRIW+isyncs.litmus. ```shell % diycross7 -arch PPC -name IRIW Rfe allRR Fre Rfe allRR Fre Generator produced 28 tests % ls @all IRIW.litmus IRIW+addr+po.litmus IRIW+lwsync+addr.litmus ... IRIW+isyncs.litmus ``` -------------------------------- ### Lexeme action: start string literal scanning Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/LexicalStructure.tex Switches to scanning literal strings via the scanstring function. ```asl \actionstartstring(s_1, s_2) \triangleq \scanstring(\emptylist, s_2) ``` -------------------------------- ### DesugarLHSAccess rule example Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/AssignableExpressions.tex Shows the desugaring of an lhsaccess on an identifier into an lexpr AST node. The rule is defined in the file DesugarLHSAccess/ASTRule.DesugarLHSAccess.asl. ```asl _0 () i 1..||: _i (_i-1, ) if _i = () (_i-1, ) if _i = () = _||(_||, ) { rcl &:& , &:& } ``` -------------------------------- ### diy7 -conf x86-safe.conf Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Runs diy7 with the safe configuration file for x86. The output shows the number of tests generated and the set of relaxations tested (empty set for safe tests). ```shell % diy7 -conf x86-safe.conf Generator produced 38 tests Relaxations tested: {} ``` -------------------------------- ### Lexeme action: start multi-line comment scanning Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/LexicalStructure.tex Switches to scanning multi-line comments by changing the lexical specification to speccomment. ```asl \actionstartcomment(s_1, s_2) \triangleq \aslscan(\speccomment, s_2) ``` -------------------------------- ### Generate W5.litmus with diyone7 -obs accept Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Shows the diyone7 command and resulting W5.litmus file for a three-write test with a fenced observer thread on y. The final condition observes x directly (x=2). Using -obs force would produce two observers, while -obs avoid would fail. ```text % diyone7 -obs accept -obstype fenced -arch PPC -name W5 Coe Coe PodWW Coe PodWW % cat W5.litmus PPC W5 "Coe Coe PodWW Coe PodWW" { 0:r2=y; 1:r2=y; 1:r4=x; 2:r2=x; 2:r4=y; 3:r2=y; } P0 | P1 | P2 | P3 ; lwz r1,0(r2) | li r1,3 | li r1,2 | li r1,2 ; sync | stw r1,0(r2) | stw r1,0(r2) | stw r1,0(r2) ; lwz r3,0(r2) | li r3,1 | li r3,1 | ; sync | stw r3,0(r4) | stw r3,0(r4) | ; lwz r4,0(r2) | | | ; exists (x=2 /\ 0:r1=1 /\ 0:r3=2 /\ 0:r4=3) ``` -------------------------------- ### DesugarLHSTuple rule example Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/AssignableExpressions.tex Shows the desugaring of a list of lhsaccess elements into an lexpr AST node. The rule is defined in the file DesugarLHSTuple/ASTRule.DesugarLHSTuple.asl. ```asl i 1..||: (_i) _i [i 1..||: _i] () () ``` -------------------------------- ### Build and run test with prefetch metadata Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Commands to compile and run the 6.SB+Prefetch.litmus test using litmus7 with custom preload mode, then execute the resulting binary. ```shell % litmus7 -mem indirect -preload custom -o R 6.SB+Prefetch.litmus % cd R % make ``` ```shell % ./6.SB+Prefetch.exe Test 6.SB Allowed Histogram (63 states) 674 *>0:EAX=0; 1:EAX=0; 2:EAX=0; 3:EAX=0; 4:EAX=0; 5:EAX=0; ... Witnesses Positive: 674, Negative: 999326 ... Prefetch=0:x=F,0:y=T,1:y=F,1:z=T,2:a=T,2:z=F,3:a=F,3:b=T,4:b=F,4:c=T,5:c=F,5:x=T ... ``` -------------------------------- ### Extract and compile kernel test archive Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Commands to extract the archive and compile the kernel module on the target machine. Requires kernel headers to be installed. ```shell % mkdir -p X && cd X && tar xmf ../X.tar % make make make -C /lib/modules/3.13.0-108-generic/build/ M=/tmp/X modules make[1]: Entering directory `/usr/src/linux-headers-3.13.0-108-generic' CC [M] /tmp/X/litmus000.o Building modules, stage 2. MODPOST 1 modules CC /tmp/X/litmus000.mod.o LD [M] /tmp/X/litmus000.ko make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-108-generic' ``` -------------------------------- ### Generate tests with diy7 using X.conf Source: https://github.com/herd/herdtools7/blob/master/doc/gen.tex Generates 23 simple, critical tests for X86 up to three threads using the configuration file X.conf. The output lists the generated .litmus files in the current directory. ```shell % diy7 -conf X.conf Generator produced 23 tests % ls @all X003.litmus X007.litmus X011.litmus X015.litmus X019.litmus X.conf X000.litmus X004.litmus X008.litmus X012.litmus X016.litmus X020.litmus X001.litmus X005.litmus X009.litmus X013.litmus X017.litmus X021.litmus X002.litmus X006.litmus X010.litmus X014.litmus X018.litmus X022.litmus ``` -------------------------------- ### Run 6.SB.exe with +vb to show synchronisation timings Source: https://github.com/herd/herdtools7/blob/master/doc/litmus.tex Executes the test with the +vb option to print synchronisation timing information. The output shows five columns of timebase delays for each thread across iterations, demonstrating loose synchronisation in user mode. ```shell % ./6.SB.exe +vb 99999: 162768 420978 564546 -894 669468 99998: -93 3 81 -174 -651 99997: -975 -30 -33 93 -192 99996: 990 1098 852 1176 774 ... ``` -------------------------------- ### Run litmus7 with kvm-armv8.1 for FEAT_LSE support Source: https://github.com/herd/herdtools7/blob/master/catalogue/aarch64-VMSA/README.md Use this command when the hardware implements Armv8.1-A with FEAT_LSE support. It generates tests using the kvm-armv8.1 machine and the VMSA-kinds.txt file. ```shell % litmus7 -mach kvm-armv8.1 -a 2 -o ${KUT_DIR}/litmus -kinds tests/VMSA-kinds.txt tests/@all ``` -------------------------------- ### Run main0.asl and print exit status Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/RuntimeEnvironment.tex Shows how to run the specification main0.asl with the aslref interpreter and print the return status. The output shows a status of 0, indicating success. ```shell > aslref main0.asl; echo "status="$? > status=0 ``` -------------------------------- ### Build carpenter with dune Source: https://github.com/herd/herdtools7/blob/master/asllib/carpenter/README.md Builds the carpenter executable using the dune build system. ```bash dune build asllib/carpenter ``` -------------------------------- ### Expanded Binop rule for throwing config Source: https://github.com/herd/herdtools7/blob/master/asllib/doc/ASLFormal.tex The expanded rule for the case where the first transition results in a throwing configuration. ```ASL {, , } ( , ) ( , (, , ) ) ``` -------------------------------- ### Run with litmus7 Source: https://github.com/herd/herdtools7/blob/master/catalogue/aarch64-mixed/README.md Run litmus7 with the specified options to generate tests in the TESTS_DIR, then build and run them. ```shell % litmus7 -a 2 -kinds tests/kinds.txt -o ${TESTS_DIR}/ tests/@all ``` ```shell % cd ${TESTS_DIR} ``` ```shell % make ``` ```shell % sh ./run.sh ```