Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/56902 )

Change subject: arch-x86: Add a symbol to generate a random string.
......................................................................

arch-x86: Add a symbol to generate a random string.

This can be used to unique-ify labels in macros.

Change-Id: Ic94b7729cd6e48b5b5a2b4b76e20dff4aafd9b73
---
M src/arch/x86/ucasmlib/arch/x86/symbols.py
1 file changed, 18 insertions(+), 0 deletions(-)



diff --git a/src/arch/x86/ucasmlib/arch/x86/symbols.py b/src/arch/x86/ucasmlib/arch/x86/symbols.py
index aa48629..6421aa2 100644
--- a/src/arch/x86/ucasmlib/arch/x86/symbols.py
+++ b/src/arch/x86/ucasmlib/arch/x86/symbols.py
@@ -32,6 +32,9 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+import random
+import string
+
 symbols = {}

 def gpRegIdx(idx):
@@ -192,3 +195,7 @@
 symbols['fsw'] = ctrlRegIdx('MISCREG_FSW')
 symbols['fcw'] = ctrlRegIdx('MISCREG_FCW')
 symbols['ftw'] = ctrlRegIdx('MISCREG_FTW')
+
+def random_variable_name(strlen=8):
+    return ''.join(random.choices(string.ascii_letters, k=strlen))
+symbols['rnd_str'] = random_variable_name

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56902
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ic94b7729cd6e48b5b5a2b4b76e20dff4aafd9b73
Gerrit-Change-Number: 56902
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to