From a8d09acd402084cf8fdce284ae3844946e1c6622 Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Thu, 1 Aug 2019 12:21:30 -0700 Subject: [PATCH] Use ordered dict instead of sorting keys --- compiler/characterizer/functional.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/characterizer/functional.py b/compiler/characterizer/functional.py index 6b71ee8b..6dcb54e0 100644 --- a/compiler/characterizer/functional.py +++ b/compiler/characterizer/functional.py @@ -6,6 +6,7 @@ # All rights reserved. # import sys,re,shutil +import collections from design import design import debug import math @@ -52,7 +53,8 @@ class functional(simulation): # Number of checks can be changed self.num_cycles = 15 - self.stored_words = {} + # This is to have ordered keys for random selection + self.stored_words = collections.OrderedDict() self.write_check = [] self.read_check = [] @@ -258,7 +260,7 @@ class functional(simulation): def get_data(self): """ Gets an available address and corresponding word. """ # Currently unused but may need later depending on how the functional test develops - addr = random.choice(sort(list(self.stored_words.keys()))) + addr = random.choice(list(self.stored_words.keys())) word = self.stored_words[addr] return (addr,word)