diff options
-rw-r--r-- | passes/cmds/scratchpad.cc | 7 | ||||
-rwxr-xr-x | tests/various/scratchpad.sh | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/passes/cmds/scratchpad.cc b/passes/cmds/scratchpad.cc index 7d53c8a4f..c11c41caf 100644 --- a/passes/cmds/scratchpad.cc +++ b/passes/cmds/scratchpad.cc @@ -2,6 +2,7 @@ * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at> + * 2019 Nina Engelhardt <nak@symbioticeda.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -30,14 +31,18 @@ struct ScratchpadPass : public Pass { { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" scratchpad [ -get id | -set id val | -unset id | -copy id1 id2 ]\n"); + log(" scratchpad [options]\n"); log("\n"); log("This pass allows to read and modify values from the scratchpad of the current\n"); log("design. Options:\n"); log(" -get <identifier>\n"); + log(" print the value saved in the scratchpad under the given identifier\n"); log(" -set <identifier> <value>\n"); + log(" save the given value in the scratchpad under the given identifier\n"); log(" -unset <identifier>\n"); + log(" remove the entry for the given identifier from the scratchpad\n"); log(" -copy <identifier_from> <identifier_to>\n"); + log(" copy the value of the first identifier to the second identifier\n"); log("The identifier may not contain whitespace. By convention, it is usually prefixed\n"); log("by the name of the pass that uses it, e.g. 'opt.did_something'. If the value\n"); log("contains whitespace, it must be enclosed in double quotes.\n"); diff --git a/tests/various/scratchpad.sh b/tests/various/scratchpad.sh new file mode 100755 index 000000000..4e92473f8 --- /dev/null +++ b/tests/various/scratchpad.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +trap 'echo "ERROR in scratchpad.sh" >&2; exit 1' ERR + +../../yosys -qp "scratchpad -set foo \"bar baz\"; \ +scratchpad -copy foo oof; scratchpad -unset foo; \ +tee -o scratchpad1.log scratchpad -get oof; \ +tee -o scratchpad2.log scratchpad -get foo" + +test "$(cat scratchpad1.log)" = "bar baz" +test "$(cat scratchpad2.log)" = "\"foo\" not set" + +rm scratchpad1.log +rm scratchpad2.log |