Skip to content

Commit

Permalink
adding SimpleTestArray to test_memory.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ruck314 committed Jul 19, 2024
1 parent c01e850 commit 50af7eb
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pyrogue as pr
import pyrogue.interfaces.simulation
import rogue.interfaces.memory
import numpy as np

#rogue.Logging.setLevel(rogue.Logging.Debug)
#import logging
Expand Down Expand Up @@ -79,6 +80,23 @@ def __init__(self,**kwargs):
mode = "RW",
))

self.add(pr.RemoteVariable(
name = 'SimpleTestArray',
offset = 0x200,
base = pr.UInt,
bitSize = 32*64,
bitOffset = 0,
numValues = 64,
valueBits = 32,
valueStride = 32,
retryCount = 1,
updateNotify = False,
bulkOpEn = False,
hidden = True,
verify = False,
groups = ['NoStream','NoState','NoConfig'],
))

class MemDev(pr.Device):

def __init__(self,modeConfig='RW',**kwargs):
Expand Down Expand Up @@ -110,7 +128,6 @@ def __init__(self,modeConfig='RW',**kwargs):
value = None if modeConfig=='RW' else i,
))


class DummyTree(pr.Root):

def __init__(self):
Expand Down Expand Up @@ -199,5 +216,12 @@ def test_memory():
raise AssertionError(f'Verification Failure: retAA={retAA}, retAB={retAB}, retBA={retBA}, retBB={retBB}, retBC={retBC}, retBD={retBD}')


dataSetArray = np.random.randint(0, (2**32)-1, size=64, dtype=np.uint32)
root.SimpleDev.SimpleTestArray.set(dataSetArray)
dataGetArray = root.SimpleDev.SimpleTestArray.get(read=True)

if not np.array_equal(dataSetArray, dataGetArray):
raise AssertionError('Verification Failure: dataSetArray and dataGetArray do not match')

if __name__ == "__main__":
test_memory()

0 comments on commit 50af7eb

Please sign in to comment.