Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PandABox-tst
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
PandABox-tst
Commits
89e03e8b
Commit
89e03e8b
authored
Mar 02, 2017
by
Christopher Turner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring
parent
30665763
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
100 deletions
+99
-100
Encoder.py
tests/Encoder.py
+30
-30
LvdsLB.py
tests/LvdsLB.py
+8
-15
LvdsU.py
tests/LvdsU.py
+8
-12
PandATest.py
tests/PandATest.py
+17
-7
Plugged.py
tests/Plugged.py
+2
-0
TtlLB.py
tests/TtlLB.py
+16
-24
TtlU.py
tests/TtlU.py
+16
-12
Unplugged.py
tests/Unplugged.py
+2
-0
No files found.
tests/Encoder.py
View file @
89e03e8b
...
...
@@ -21,13 +21,6 @@ class Encoder(PandATest.PandATest):
(
'INENC{}.PROTOCOL=SSI'
.
format
(
self
.
blocknum
),
(
'OK'
,
0
)),
(
'OUTENC{}.PROTOCOL=SSI'
.
format
(
self
.
blocknum
),
(
'OK'
,
0
))
])
quad_fields
=
[
'A'
,
'B'
,
'Z'
]
q_ch_connect
=
{
quad_fields
[
0
]:
quad_fields
[
0
],
quad_fields
[
1
]:
quad_fields
[
1
],
quad_fields
[
2
]:
quad_fields
[
2
],
}
ssi_fields
=
[
'CLK'
,
'DATA'
]
#SET FOR QUADRATURE
for
cmd
,
expected
in
setup_quad_commands
.
items
():
...
...
@@ -35,13 +28,15 @@ class Encoder(PandATest.PandATest):
self
.
test_result
.
append
(
self
.
check_response
(
response
,
expected
[
0
],
cmd
,
expected
[
1
]))
default
=
0
for
outp
in
quad_fields
:
for
val
in
[
1
,
0
]:
out_cmd
=
'OUTENC{}.{}={}'
.
format
(
self
.
blocknum
,
outp
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'INENC{}.{}?'
.
format
(
self
.
blocknum
,
'{}'
)
self
.
toggle_check
(
in_cmd
,
outp
,
quad_fields
,
q_ch_connect
[
outp
],
default
,
val
)
self
.
outputs
=
[
'A'
,
'B'
,
'Z'
]
self
.
inputs
=
self
.
outputs
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
self
.
inputs
[
0
],
self
.
outputs
[
1
]:
self
.
inputs
[
1
],
self
.
outputs
[
2
]:
self
.
inputs
[
2
],
}
default_val
=
0
self
.
toggle_val
(
'OUTENC'
,
''
,
'INENC'
,
''
,
default_val
)
#SET FOR SSI
for
cmd
,
expected
in
setup_ssi_commands
.
items
():
...
...
@@ -49,22 +44,27 @@ class Encoder(PandATest.PandATest):
self
.
test_result
.
append
(
self
.
check_response
(
response
,
expected
[
0
],
cmd
,
expected
[
1
]))
#TOGGLE SSI FIELDS
ok_string
=
{
0
:
"..NOT OK"
,
1
:
"..OK"
# #TOGGLE SSI FIELDS
self
.
outputs
=
[
'CLK'
]
self
.
inputs
=
self
.
outputs
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
self
.
inputs
[
0
]
}
self
.
toggle_val
(
'INENC'
,
''
,
'OUTENC'
,
''
,
default_val
)
for
val
in
[
1
,
0
]:
out_cmd
=
'INENC{}.CLK={}'
.
format
(
self
.
blocknum
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'OUTENC{}.{}?'
.
format
(
self
.
blocknum
,
'{}'
)
self
.
toggle_check
(
in_cmd
,
'.CLK'
,
[
'CLK'
],
'CLK'
,
default
,
val
)
for
val
in
[
1
,
0
]:
out_cmd
=
'OUTENC{}.DATA={}'
.
format
(
self
.
blocknum
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'INENC{}.{}?'
.
format
(
self
.
blocknum
,
'{}'
)
self
.
toggle_check
(
in_cmd
,
'.DATA'
,
[
'DATA'
],
'DATA'
,
default
,
val
)
self
.
outputs
=
[
'DATA'
]
self
.
inputs
=
self
.
outputs
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
self
.
inputs
[
0
]
}
self
.
toggle_val
(
'OUTENC'
,
''
,
'INENC'
,
''
,
default_val
)
return
not
all
(
self
.
test_result
)
\ No newline at end of file
def
toggle_val
(
self
,
out_param
,
out_field
,
in_param
,
in_field
,
default
):
for
outp
in
self
.
outputs
:
for
val
in
[
1
,
0
]:
out_cmd
=
'{}{}.{}={}'
.
format
(
out_param
,
self
.
blocknum
,
outp
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'{}{}.{}?'
.
format
(
in_param
,
self
.
blocknum
,
'{}'
)
self
.
toggle_check
(
in_cmd
,
outp
,
self
.
ch_connect
[
outp
],
default
,
val
)
tests/LvdsLB.py
View file @
89e03e8b
...
...
@@ -10,6 +10,12 @@ class LvdsLB(PandATest.PandATest):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
LvdsLB
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
outputs
=
[
1
,
2
]
self
.
inputs
=
[
1
,
2
]
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
self
.
inputs
[
0
],
self
.
outputs
[
1
]:
self
.
inputs
[
1
]
}
def
get_user_input
(
self
):
inputy
=
'.'
...
...
@@ -18,18 +24,5 @@ class LvdsLB(PandATest.PandATest):
inputy
=
raw_input
()
def
test_code
(
self
):
outputs
=
[
1
,
2
]
inputs
=
[
1
,
2
]
ch_connect
=
{
outputs
[
0
]:
inputs
[
0
],
outputs
[
1
]:
inputs
[
1
]
}
default
=
0
for
outp
in
outputs
:
for
val
in
[
1
,
0
]:
out_cmd
=
'LVDSOUT{}.VAL={}'
.
format
(
outp
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'LVDSIN{}.VAL?'
self
.
toggle_check
(
in_cmd
,
outp
,
inputs
,
ch_connect
[
outp
],
default
,
val
)
return
not
all
(
self
.
test_result
)
\ No newline at end of file
default_val
=
0
self
.
toggle_val
(
'LVDSOUT'
,
'VAL'
,
'LVDSIN'
,
'VAL'
,
default_val
)
\ No newline at end of file
tests/LvdsU.py
View file @
89e03e8b
...
...
@@ -10,6 +10,12 @@ class LvdsU(PandATest.PandATest):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
LvdsU
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
inputs
=
[
1
,
2
]
self
.
outputs
=
[
1
,
2
]
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
-
1
,
self
.
outputs
[
1
]:
-
1
}
def
get_user_input
(
self
):
inputy
=
'.'
...
...
@@ -18,15 +24,5 @@ class LvdsU(PandATest.PandATest):
inputy
=
raw_input
()
def
test_code
(
self
):
inputs
=
[
1
,
2
]
outputs
=
[
1
,
2
]
default
=
1
for
outp
in
outputs
:
for
val
in
[
1
,
0
]:
out_cmd
=
'LVDSOUT{}.VAL={}'
.
format
(
outp
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'LVDSIN{}.VAL?'
self
.
toggle_check
(
in_cmd
,
outp
,
inputs
,
-
1
,
default
,
val
)
return
not
all
(
self
.
test_result
)
\ No newline at end of file
default_val
=
1
self
.
toggle_val
(
'LVDSOUT'
,
'VAL'
,
'LVDSIN'
,
'VAL'
,
default_val
)
tests/PandATest.py
View file @
89e03e8b
...
...
@@ -9,8 +9,8 @@ class PandATest(object):
self
.
test_result
=
[]
self
.
blocknum
=
blocknum
self
.
ok_string
=
{
0
:
"..
NOT OK"
,
1
:
"..
OK"
0
:
"..NOT OK"
,
1
:
"..OK"
}
self
.
toggle_cmd
=
{
0
:
'BITS.ZERO'
,
...
...
@@ -61,14 +61,24 @@ class PandATest(object):
check
=
response
==
expected
if
check
:
self
.
logger
.
info
(
"{:<2
0
} [{:<9}] ..OK"
.
format
(
cmd
,
response
))
self
.
logger
.
info
(
"{:<2
7
} [{:<9}] ..OK"
.
format
(
cmd
,
response
))
return
1
else
:
self
.
logger
.
info
(
"{:<2
0
} [{:<9}] ..NOT OK"
.
format
(
cmd
,
response
))
self
.
logger
.
info
(
"{:<2
7
} [{:<9}] ..NOT OK"
.
format
(
cmd
,
response
))
return
0
def
toggle_check
(
self
,
in_cmd
,
output
,
inputs
,
expected
,
default
,
tgl_val
):
for
inp
in
inputs
:
def
toggle_val
(
self
,
out_param
,
out_field
,
in_param
,
in_field
,
default
):
for
outp
in
self
.
outputs
:
for
val
in
[
1
,
0
]:
out_cmd
=
'{}{}.{}={}'
.
format
(
out_param
,
outp
,
out_field
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'{}{}.{}?'
.
format
(
in_param
,
'{}'
,
in_field
)
self
.
toggle_check
(
in_cmd
,
outp
,
self
.
ch_connect
[
outp
],
default
,
val
)
def
toggle_check
(
self
,
in_cmd
,
output
,
expected
,
default
,
tgl_val
):
for
inp
in
self
.
inputs
:
cmd
=
in_cmd
.
format
(
inp
)
response
=
self
.
send_cmd
(
cmd
)
if
expected
==
inp
:
...
...
@@ -81,6 +91,6 @@ class PandATest(object):
self
.
test_result
.
append
(
1
)
else
:
self
.
test_result
.
append
(
0
)
self
.
logger
.
info
(
"{:<2
1
}[{:<9}] {}"
.
format
(
self
.
logger
.
info
(
"{:<2
8
}[{:<9}] {}"
.
format
(
"OUT{}=>{}, INP{}=>"
.
format
(
output
,
tgl_val
,
inp
),
response
,
self
.
ok_string
[
self
.
test_result
[
-
1
]]))
\ No newline at end of file
tests/Plugged.py
View file @
89e03e8b
...
...
@@ -16,7 +16,9 @@ class Plugged(PandATest.PandATest):
self
.
tp
=
TtlLB
.
TtlLB
(
*
args
,
**
kwargs
)
def
test_code
(
self
):
self
.
logger
.
info
(
'LVDS PLUGGED'
)
self
.
lp
.
test_code
()
self
.
logger
.
info
(
'TTL PLUGGED'
)
self
.
tp
.
test_code
()
def
get_summary
(
self
):
...
...
tests/TtlLB.py
View file @
89e03e8b
...
...
@@ -9,6 +9,20 @@ class TtlLB(PandATest.PandATest):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
TtlLB
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
outputs
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
self
.
inputs
=
[
1
,
2
,
3
,
4
,
5
,
6
]
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
self
.
inputs
[
0
],
self
.
outputs
[
1
]:
self
.
inputs
[
1
],
self
.
outputs
[
2
]:
self
.
inputs
[
2
],
self
.
outputs
[
3
]:
self
.
inputs
[
3
],
self
.
outputs
[
4
]:
self
.
inputs
[
4
],
self
.
outputs
[
5
]:
self
.
inputs
[
5
],
self
.
outputs
[
6
]:
self
.
inputs
[
0
],
self
.
outputs
[
7
]:
self
.
inputs
[
1
],
self
.
outputs
[
8
]:
self
.
inputs
[
2
],
self
.
outputs
[
9
]:
self
.
inputs
[
3
]
}
def
get_user_input
(
self
):
inputy
=
'.'
...
...
@@ -17,27 +31,5 @@ class TtlLB(PandATest.PandATest):
inputy
=
raw_input
()
def
test_code
(
self
):
outputs
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
inputs
=
[
1
,
2
,
3
,
4
,
5
,
6
]
ch_connect
=
{
outputs
[
0
]:
inputs
[
0
],
outputs
[
1
]:
inputs
[
1
],
outputs
[
2
]:
inputs
[
2
],
outputs
[
3
]:
inputs
[
3
],
outputs
[
4
]:
inputs
[
4
],
outputs
[
5
]:
inputs
[
5
],
outputs
[
6
]:
inputs
[
0
],
outputs
[
7
]:
inputs
[
1
],
outputs
[
8
]:
inputs
[
2
],
outputs
[
9
]:
inputs
[
3
]
}
default
=
0
for
outp
in
outputs
:
for
val
in
[
1
,
0
]:
out_cmd
=
'TTLOUT{}.VAL={}'
.
format
(
outp
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'TTLIN{}.VAL?'
self
.
toggle_check
(
in_cmd
,
outp
,
inputs
,
ch_connect
[
outp
],
default
,
val
)
return
not
all
(
self
.
test_result
)
\ No newline at end of file
default_val
=
0
self
.
toggle_val
(
'TTLOUT'
,
'VAL'
,
'TTLIN'
,
'VAL'
,
default_val
)
\ No newline at end of file
tests/TtlU.py
View file @
89e03e8b
...
...
@@ -10,6 +10,20 @@ class TtlU(PandATest.PandATest):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
TtlU
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
outputs
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
self
.
inputs
=
[
1
,
2
,
3
,
4
,
5
,
6
]
self
.
ch_connect
=
{
self
.
outputs
[
0
]:
-
1
,
self
.
outputs
[
1
]:
-
1
,
self
.
outputs
[
2
]:
-
1
,
self
.
outputs
[
3
]:
-
1
,
self
.
outputs
[
4
]:
-
1
,
self
.
outputs
[
5
]:
-
1
,
self
.
outputs
[
6
]:
-
1
,
self
.
outputs
[
7
]:
-
1
,
self
.
outputs
[
8
]:
-
1
,
self
.
outputs
[
9
]:
-
1
,
}
def
get_user_input
(
self
):
inputy
=
'.'
...
...
@@ -18,15 +32,5 @@ class TtlU(PandATest.PandATest):
inputy
=
raw_input
()
def
test_code
(
self
):
outputs
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
inputs
=
[
1
,
2
,
3
,
4
,
5
,
6
]
default
=
0
for
outp
in
outputs
:
for
val
in
[
1
,
0
]:
out_cmd
=
'TTLOUT{}.VAL={}'
.
format
(
outp
,
self
.
toggle_cmd
[
val
])
self
.
set_output
(
out_cmd
)
in_cmd
=
'TTLIN{}.VAL?'
self
.
toggle_check
(
in_cmd
,
outp
,
inputs
,
-
1
,
default
,
val
)
return
not
all
(
self
.
test_result
)
\ No newline at end of file
default_val
=
0
self
.
toggle_val
(
'TTLOUT'
,
'VAL'
,
'TTLIN'
,
'VAL'
,
default_val
)
\ No newline at end of file
tests/Unplugged.py
View file @
89e03e8b
...
...
@@ -16,7 +16,9 @@ class Unplugged(PandATest.PandATest):
self
.
tu
=
TtlU
.
TtlU
(
*
args
,
**
kwargs
)
def
test_code
(
self
):
self
.
logger
.
info
(
'LVDS UNPLUGGED'
)
self
.
lu
.
test_code
()
self
.
logger
.
info
(
'TTL UNPLUGGED'
)
self
.
tu
.
test_code
()
def
get_summary
(
self
):
...
...
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