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
08a34e9d
Commit
08a34e9d
authored
Apr 03, 2017
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added read/write by offset (not completely); fixed SV test-vectors generation
parent
95403166
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
WbOverlay.py
sw/WbOverlay.py
+25
-18
No files found.
sw/WbOverlay.py
View file @
08a34e9d
...
...
@@ -38,11 +38,13 @@ from CommonFunctions import *
class
WbOverlay
(
object
):
# TODO: add Offset everywhere (also to debug)
module
=
None
# encoreio.Module
debug
=
False
# output low-level transactions
debugSv
=
False
# write SystemVerilog file with all low-level transactions
debugSvFile
=
""
# path to the output file for SystemVerilog debugging
debugSvFp
=
None
# 'file' object of SystemVerilog debugging output file
offsetMult
=
4
# for byte/word conversion for SV debug output
def
__init__
(
self
,
drvName
,
lun
):
self
.
module
=
encoreio
.
Module
.
get_instance
(
drvName
,
lun
)
...
...
@@ -72,9 +74,8 @@ class WbOverlay(object):
self
.
debugSvFp
.
write
(
"
\n
"
)
self
.
debugSvFp
.
write
(
"$display(
\"
Error count:
%0
d
\\
n
\"
, errors);
\n
"
)
self
.
debugSvFp
.
close
()
if
filePath
==
""
:
self
.
debugSv
=
False
else
:
if
filePath
<>
""
:
# open SystemVerilog debugging stream
self
.
debugSvFp
=
open
(
filePath
,
"w"
)
self
.
debugSvFp
.
write
(
"uint32_t dataOut;
\n
"
)
...
...
@@ -82,24 +83,30 @@ class WbOverlay(object):
self
.
debugSvFp
.
write
(
"
\n
"
)
self
.
debugSv
=
True
def
Read
(
self
,
register
):
result
=
self
.
module
.
read
(
register
)[
0
]
self
.
PrintDebug
(
ConColors
.
MAGENTA
+
"WB_READ:"
+
ConColors
.
NONE
+
" ["
+
register
+
"] = "
+
hex
(
result
))
if
self
.
debugSvFp
:
address
=
int
(
self
.
module
[
register
][
"offset"
],
16
)
self
.
debugSvFp
.
write
(
"WbRead("
+
str
(
address
)
+
", dataOut,
\"
WB_READ: "
+
register
+
":
\"
);
\n
"
)
self
.
debugSvFp
.
write
(
"assert (dataOut == "
+
str
(
result
)
+
") else begin
\n
"
)
def
Read
(
self
,
register
,
Offset
=
0
):
result
=
self
.
module
.
read
(
register
,
start
=
Offset
,
to
=
Offset
+
1
)[
0
]
RegNameVerbose
=
register
if
Offset
>
0
:
RegNameVerbose
=
RegNameVerbose
+
" + 0x
%
x"
%
Offset
self
.
PrintDebug
(
ConColors
.
MAGENTA
+
"WB_READ:"
+
ConColors
.
NONE
+
" ["
+
RegNameVerbose
+
"] = "
+
hex
(
result
))
if
self
.
debugSv
:
address
=
int
(
self
.
module
[
register
][
"offset"
],
16
)
+
Offset
*
self
.
offsetMult
self
.
debugSvFp
.
write
(
"WbRead(32'h
%08
x, dataOut,
\"
WB_READ:
%
s:
\"
);
\n
"
%
(
address
,
RegNameVerbose
))
self
.
debugSvFp
.
write
(
"assert (dataOut == 32'h
%08
x) else begin
\n
"
%
result
)
self
.
debugSvFp
.
write
(
" $error(
\"
WB_READ different, result should be "
+
hex
(
int
(
result
))
+
"!
\"
);
\n
"
)
self
.
debugSvFp
.
write
(
" errors = errors + 1;
\n
"
)
self
.
debugSvFp
.
write
(
"end
\n
"
)
return
result
def
Write
(
self
,
register
,
data
):
self
.
PrintDebug
(
ConColors
.
CYAN
+
"WB_WRITE:"
+
ConColors
.
NONE
+
" ["
+
register
+
"] <- "
+
hex
(
data
))
if
self
.
debugSvFp
:
address
=
int
(
self
.
module
[
register
][
"offset"
],
16
)
self
.
debugSvFp
.
write
(
"WbWrite("
+
str
(
address
)
+
", "
+
str
(
data
)
+
",
\"
WB_WRITE: "
+
register
+
":
\"
);
\n
"
)
self
.
module
.
write
(
register
,
(
data
,))
def
Write
(
self
,
register
,
data
,
Offset
=
0
):
RegNameVerbose
=
register
if
Offset
>
0
:
RegNameVerbose
=
RegNameVerbose
+
" + 0x
%
x"
%
Offset
self
.
PrintDebug
(
ConColors
.
CYAN
+
"WB_WRITE:"
+
ConColors
.
NONE
+
" ["
+
RegNameVerbose
+
"] <- "
+
hex
(
data
))
if
self
.
debugSv
:
address
=
int
(
self
.
module
[
register
][
"offset"
],
16
)
+
Offset
*
self
.
offsetMult
self
.
debugSvFp
.
write
(
"WbWrite(32'h
%08
x, 32'h
%08
x,
\"
WB_WRITE:
%
s:
\"
);
\n
"
%
(
address
,
data
,
RegNameVerbose
))
self
.
module
.
write
(
register
,
(
data
,),
start
=
Offset
,
to
=
Offset
+
1
)
def
SetBits
(
self
,
register
,
mask
,
bits
=
-
1
):
if
bits
==
-
1
:
...
...
@@ -113,7 +120,7 @@ class WbOverlay(object):
result
=
self
.
module
.
read
(
register
,
start
=
start
,
to
=
to
)
self
.
PrintDebug
(
ConColors
.
MAGENTA
+
"WB_READ_MULTI:"
+
ConColors
.
NONE
+
" ["
+
register
+
"]("
+
str
(
start
)
+
":"
+
str
(
to
)
+
") = "
)
self
.
PrintDebugHex
(
result
)
if
self
.
debugSv
Fp
:
if
self
.
debugSv
:
address
=
int
(
self
.
module
[
register
][
"offset"
],
16
)
if
to
==
-
1
:
to
=
int
(
self
.
module
[
register
][
"depth"
],
16
)
...
...
@@ -128,7 +135,7 @@ class WbOverlay(object):
def
WriteMulti
(
self
,
register
,
data
,
start
=
0
,
to
=
-
1
):
self
.
PrintDebug
(
ConColors
.
CYAN
+
"WB_WRITE_MULTI:"
+
ConColors
.
NONE
+
" ["
+
register
+
"]("
+
str
(
start
)
+
":"
+
str
(
to
)
+
") <- "
)
self
.
PrintDebugHex
(
data
)
if
self
.
debugSv
Fp
:
if
self
.
debugSv
:
address
=
int
(
self
.
module
[
register
][
"offset"
],
16
)
if
to
==
-
1
:
to
=
int
(
self
.
module
[
register
][
"depth"
])
...
...
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