* 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
{
// |---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");
--- /dev/null
+#!/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