Commit abaf1726 authored by Jan Pospisil's avatar Jan Pospisil

added possibility to write less data to the memories (for shorter SV simulation)

parent cd3093e2
......@@ -21,7 +21,7 @@ class ConColors:
m = encoreio.Module.get_instance('fmc_fpg', 0)
WB_DEBUG = True
WB_DEBUG_2_SV = False
WB_DEBUG_2_SV = True
WB_DEBUG_2_SV_FILE = 'wb_trace.svh'
###################################################################
......@@ -219,14 +219,15 @@ def SetVcxoFrequency(compensation):
# channel: 1, 2, 0 (for both)
# memory: 'set', 'res', '*'
def ClearMemory(channel, memory):
# if memoryPart > -1: clear only first memoryPart words
def ClearMemory(channel, memory, memoryPart = -1):
if channel == 1:
address = 'ch1_'
elif channel == 2:
address = 'ch2_'
elif channel == 0:
ClearMemory(1, memory)
ClearMemory(2, memory)
ClearMemory(1, memory, memoryPart)
ClearMemory(2, memory, memoryPart)
return
else:
raise Exception("Bad channel!")
......@@ -236,13 +237,18 @@ def ClearMemory(channel, memory):
elif memory == "res":
address += 'res_mem'
elif memory == "*":
ClearMemory(channel, 'set')
ClearMemory(channel, 'res')
ClearMemory(channel, 'set', memoryPart)
ClearMemory(channel, 'res', memoryPart)
return
else:
raise Exception("Bad memory!")
WbWriteMulti(address, (0,)*2048)
partToClear = 2048
to = -1
if memoryPart > -1:
partToClear = memoryPart
to = memoryPart
WbWriteMulti(address, (0,)*partToClear, to = to)
# channel: 1, 2, 0 (for both)
# pulse: 0, 1
......@@ -368,18 +374,18 @@ def Debug():
## Test functions
###################################################################
def Init():
def Init(memoryPart = -1):
WbWrite('control', 0)
SpiInit()
Ad9512Init()
SetTriggerThreshold(0.5)
SelectClock(0)
SetVcxoFrequency(-0.2105) # 125.0000 MHz
ClearMemory(0, '*')
ClearMemory(0, '*', memoryPart)
def TestPulse(channel = 1):
def TestPulse(channel = 1, overflow = 17820):
# configure channel
WbWrite('overflow', 17820)
WbWrite('overflow', overflow)
WbWrite('trig_latency', 8)
# start = 5
......@@ -411,10 +417,10 @@ def TestPulse(channel = 1):
Enable(channel)
StartOnce(channel)
Init()
Init(15)
Control()
Status()
TestPulse(1)
TestPulse(1, 400)
# TestPulse(2)
Control()
Status()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment