Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 2cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 2cha
Commits
66eb9d1f
Commit
66eb9d1f
authored
Aug 11, 2016
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added fine delay control; added possibility to generate just set/reset pulse
parent
52532479
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
FFPG_driver.py
sw/FFPG_driver.py
+27
-17
No files found.
sw/FFPG_driver.py
View file @
66eb9d1f
...
...
@@ -19,7 +19,7 @@ class ConColors:
m
=
encoreio
.
Module
.
get_instance
(
'fmc_fpg'
,
0
)
WB_DEBUG
=
Tru
e
WB_DEBUG
=
Fals
e
###################################################################
## WishBone access overlay
...
...
@@ -92,6 +92,10 @@ def SpiWrite(register, data):
def
Ad9512Init
():
# power down unused output (OUT2)
SpiWrite
(
0x3f
,
0x03
)
# fine delay
SpiWrite
(
0x34
,
0x0
)
# use fine delay
delay
=
2
# 0-31
SpiWrite
(
0x36
,
(
delay
&
0x1f
)
<<
1
)
# set fine delay
# select CLK1 input, power down CLK2 input
SpiWrite
(
0x45
,
0x05
)
# output frequency 200 MHz (divide by 2)
...
...
@@ -183,7 +187,8 @@ def ClearMemory(channel, memory):
# channel: 1, 2, 0 (for both)
# pulse: 0, 1
def
ConfigurePulse
(
channel
,
start
,
stop
,
pulse
):
# which: 0 - both, 1 - set, 2 - reset
def
ConfigurePulse
(
channel
,
start
,
stop
,
pulse
,
which
=
0
):
if
channel
==
1
:
address
=
'ch1_'
elif
channel
==
2
:
...
...
@@ -204,16 +209,18 @@ def ConfigurePulse(channel, start, stop, pulse):
pulse
&=
1
position
=
start
/
32
shift
=
start
%
32
WbSetBitsMulti
(
address
+
'set_mem'
,
((
1
<<
shift
),),
((
pulse
<<
shift
),),
start
=
position
,
to
=
position
+
1
)
if
which
<
2
:
position
=
start
/
32
shift
=
start
%
32
WbSetBitsMulti
(
address
+
'set_mem'
,
((
1
<<
shift
),),
((
pulse
<<
shift
),),
start
=
position
,
to
=
position
+
1
)
position
=
stop
/
32
shift
=
stop
%
32
WbSetBitsMulti
(
address
+
'res_mem'
,
((
1
<<
shift
),),
((
pulse
<<
shift
),),
start
=
position
,
to
=
position
+
1
)
if
which
!=
1
:
position
=
stop
/
32
shift
=
stop
%
32
WbSetBitsMulti
(
address
+
'res_mem'
,
((
1
<<
shift
),),
((
pulse
<<
shift
),),
start
=
position
,
to
=
position
+
1
)
def
CreatePulse
(
channel
,
start
,
stop
):
ConfigurePulse
(
channel
,
start
,
stop
,
1
)
def
CreatePulse
(
channel
,
start
,
stop
,
which
=
0
):
ConfigurePulse
(
channel
,
start
,
stop
,
1
,
which
)
def
DeletePulse
(
channel
,
start
,
stop
):
ConfigurePulse
(
channel
,
start
,
stop
,
0
)
...
...
@@ -253,7 +260,6 @@ def Control():
## Test functions
###################################################################
def
Init
():
WbWrite
(
'control'
,
0
)
SpiInit
()
...
...
@@ -266,27 +272,31 @@ def Init():
def
TestPulse
(
channel
=
1
):
# configure channel
WbWrite
(
'overflow'
,
17820
)
WbWrite
(
'trig_latency'
,
10
)
WbWrite
(
'trig_latency'
,
8
)
CreatePulse
(
channel
,
5
,
105
)
start
=
5
length
=
1
stop
=
start
+
length
CreatePulse
(
channel
,
start
+
2
*
channel
,
stop
+
2
*
channel
)
# CreatePulse(channel, 2, 2, 1)
# CreatePulse(channel, 5, 10)
# CreatePulse(channel, 25, 30)
# CreatePulse(channel, 125, 130)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_set'
,
1
00
)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_res'
,
2
00
)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_set'
,
1
)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_res'
,
1
00
)
# start channel
channel
-=
1
channel
%=
2
WbSetBits
(
'control'
,
0x4
<<
channel
,
0x4
<<
channel
)
# set output enable
channel
*=
2
WbSetBits
(
'control'
,
0x30
<<
channel
,
0x10
<<
channel
)
# set mode CONT.
Init
()
Control
()
Status
()
TestPulse
(
1
)
TestPulse
(
2
)
Control
()
Status
()
\ No newline at end of file
Status
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment