Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
c7894d2b
Unverified
Commit
c7894d2b
authored
6 years ago
by
Kevin "Bear Puncher" Weiss
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #10385 from PeterKietzmann/pr_tests_puf_args
tests/puf_sram: add input args to automation script
parents
126f232c
0de38c2a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/puf_sram/tests/example_test.py
+23
-2
23 additions, 2 deletions
tests/puf_sram/tests/example_test.py
tests/puf_sram/tests/puf_sram_if.py
+3
-3
3 additions, 3 deletions
tests/puf_sram/tests/puf_sram_if.py
with
26 additions
and
5 deletions
tests/puf_sram/tests/example_test.py
+
23
−
2
View file @
c7894d2b
...
...
@@ -7,9 +7,16 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import
argparse
import
puf_sram_if
import
numpy
DEFAULT_POWER_CYCLES
=
500
DEFAULT_OFF_TIME
=
1
DEFAULT_BAUDRATE
=
115200
DEFAULT_PORT
=
'
/dev/ttyUSB0
'
DEFAULT_INFO
=
True
def
min_erntropy
(
all_meas
):
p1
=
numpy
.
zeros
(
len
(
all_meas
[
0
]))
...
...
@@ -32,8 +39,22 @@ def min_erntropy(all_meas):
def
main_func
():
puf_sram
=
puf_sram_if
.
PufSram
()
seeds
=
puf_sram
.
get_seed_list
(
n
=
500
,
off_time
=
1
,
allow_print
=
True
)
p
=
argparse
.
ArgumentParser
()
p
.
add_argument
(
"
-n
"
,
"
--number
"
,
type
=
int
,
default
=
DEFAULT_POWER_CYCLES
,
help
=
"
Number of iterations, default: %s
"
%
DEFAULT_POWER_CYCLES
)
p
.
add_argument
(
"
-t
"
,
"
--off_time
"
,
type
=
int
,
default
=
DEFAULT_OFF_TIME
,
help
=
"
Off time, default: %s [s]
"
%
DEFAULT_OFF_TIME
)
p
.
add_argument
(
"
-p
"
,
"
--port
"
,
type
=
str
,
default
=
DEFAULT_PORT
,
help
=
"
Serial port, default: %s
"
%
DEFAULT_PORT
)
p
.
add_argument
(
"
-b
"
,
"
--baudrate
"
,
type
=
int
,
default
=
DEFAULT_BAUDRATE
,
help
=
"
Baudrate of the serial port, default: %d
"
%
DEFAULT_BAUDRATE
)
p
.
add_argument
(
"
-d
"
,
"
--disable_output
"
,
default
=
DEFAULT_INFO
,
action
=
'
store_false
'
,
help
=
"
Disable verbose output
"
)
args
=
p
.
parse_args
()
puf_sram
=
puf_sram_if
.
PufSram
(
port
=
args
.
port
,
baud
=
args
.
baudrate
)
seeds
=
puf_sram
.
get_seed_list
(
n
=
args
.
number
,
off_time
=
args
.
off_time
,
allow_print
=
args
.
disable_output
)
seeds
=
[
format
(
x
,
'
0>32b
'
)
for
x
in
seeds
]
H_min
,
H_min_rel
=
min_erntropy
(
seeds
)
...
...
This diff is collapsed.
Click to expand it.
tests/puf_sram/tests/puf_sram_if.py
+
3
−
3
View file @
c7894d2b
...
...
@@ -12,12 +12,12 @@ import time
class
PufSram
:
def
__init__
(
self
,
port
=
'
/dev/ttyUSB0
'
,
baud
=
115200
):
def
__init__
(
self
,
port
,
baud
):
self
.
__dev
=
serial
.
Serial
(
port
,
baud
,
timeout
=
10
)
if
(
self
.
__dev
.
isOpen
()
is
False
):
self
.
__dev
.
open
()
def
repower
(
self
,
shutdown_time
=
1
):
def
repower
(
self
,
shutdown_time
):
self
.
__dev
.
setRTS
(
True
)
time
.
sleep
(
shutdown_time
)
self
.
__dev
.
setRTS
(
False
)
...
...
@@ -38,7 +38,7 @@ class PufSram:
return
data
return
None
def
get_seed_list
(
self
,
n
=
10000
,
off_time
=
1
,
allow_print
=
False
):
def
get_seed_list
(
self
,
n
,
off_time
,
allow_print
):
data
=
list
()
for
i
in
range
(
0
,
n
):
self
.
repower
(
off_time
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment