Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL Blocking
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
Conv TTL Blocking
Commits
8f2b83fe
Commit
8f2b83fe
authored
Oct 15, 2013
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed sector erase error in multiboot and added multiboot support in gateware sub-proj
parent
1c09a3a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
conv-ttl-blo-gw
conv-ttl-blo-gw
+1
-1
multiboot.py
test/multiboot/multiboot.py
+31
-18
No files found.
conv-ttl-blo-gw
@
5b6e568a
Subproject commit
bfa6c70eec6fe363e70c99ffab3266e0a6bd92a5
Subproject commit
5b6e568a54976df6d864eca3ce525d93e3840ae2
test/multiboot/multiboot.py
View file @
8f2b83fe
...
...
@@ -41,6 +41,13 @@ sys.path.append("../vbcp")
from
vbcp
import
*
from
vbcpexcept
import
*
MB_BASE
=
0x40
MB_CR_OFS
=
0x00
MB_SR_OFS
=
0x04
MB_GBBAR_OFS
=
0x08
MB_MBBAR_OFS
=
0x0C
MB_FAR_OFS
=
0x10
# This function handles the OR-ing together of the data bytes and the control
# byte in FAR.
#
...
...
@@ -58,15 +65,15 @@ def spi_transfer(nbytes, cs, dat):
# write - we send up to three data bytes in one FAR register write
# writemregs - we send up to 24 data bytes in eight FAR register writes
if
isinstance
(
dat
,
int
):
ctb
.
write
(
0x90
,
(
ctrl
<<
24
)
|
dat
)
ctb
.
write
(
MB_BASE
+
MB_FAR_OFS
,
(
ctrl
<<
24
)
|
dat
)
else
:
for
i
in
xrange
(
len
(
dat
)):
wval
.
append
((
ctrl
<<
24
)
|
dat
[
i
])
ctb
.
writemregs
(
0x90
,
wval
)
ctb
.
writemregs
(
MB_BASE
+
MB_FAR_OFS
,
wval
)
# Read the data and prepare the return value
while
(
retval
&
(
1
<<
28
)
==
0
):
retval
=
ctb
.
read
(
0x90
)
retval
=
ctb
.
read
(
MB_BASE
+
MB_FAR_OFS
)
return
retval
&
0xFFFFFF
...
...
@@ -134,7 +141,7 @@ def flash_read(addr, nrbytes):
# Read bytes in groups of three
for
i
in
range
(
nrbytes
):
ret
.
append
(
spi_transfer
(
3
,
1
,
0
))
ret
.
append
(
spi_transfer
(
1
,
1
,
0
))
spi_transfer
(
1
,
0
,
0
)
return
ret
...
...
@@ -143,6 +150,7 @@ def flash_read(addr, nrbytes):
def
flash_serase
(
addr
):
spi_transfer
(
1
,
1
,
0x06
)
spi_transfer
(
1
,
0
,
0
)
spi_transfer
(
1
,
1
,
0xD8
)
# send address in reverse order
addr
=
((
addr
&
0xff0000
)
>>
16
)
|
(((
addr
&
0xff00
)
>>
8
)
<<
8
)
|
((
addr
&
0xff
)
<<
16
)
spi_transfer
(
3
,
1
,
addr
)
...
...
@@ -173,9 +181,8 @@ if __name__ == "__main__":
# Wait for proper slot number
while
1
:
try
:
slot
=
4
#slot = raw_input("Slot no.? ")
#slot = int(slot)
slot
=
raw_input
(
"Slot no.? "
)
slot
=
int
(
slot
)
ctb
=
VBCP
(
ip
,
user
,
pwd
,
slot
)
break
except
TypeError
as
e
:
...
...
@@ -217,15 +224,18 @@ if __name__ == "__main__":
print
"WRITE"
# Prepare time arrays, to calculate average time each operation takes
addr
=
0
addr
=
multiboot_addr
tdat
=
[]
twr
=
[]
twa
=
[]
te
=
[]
tp
=
[]
# Open bitstream file
f
=
open
(
"conv.txt"
,
'r'
)
tw0
=
time
.
time
()
# Each line in the input file contains the data for one page
for
fdata
in
f
:
print
addr
...
...
@@ -271,6 +281,7 @@ if __name__ == "__main__":
tdat
.
append
(
t2
-
t1
)
twr
.
append
(
t4
-
t3
)
twa
.
append
(
t5
-
t4
)
tp
.
append
(
t5
-
t3
)
#if (addr == 0x10000):
# break
...
...
@@ -278,25 +289,27 @@ if __name__ == "__main__":
#print data
#print len(data)
tw1
=
time
.
time
()
# Close file handle
f
.
close
()
# Phew! We're ready, so calculate the mean time it took for each process
print
"DONE!"
print
"read1 time:
%2.6
f"
%
float
(
tr1
-
tr0
)
print
"read2 time:
%2.6
f"
%
float
(
tr3
-
tr2
)
print
"data time:
%2.6
f"
%
float
(
sum
(
tdat
)
/
len
(
tdat
))
print
"erase time:
%2.6
f"
%
float
(
sum
(
te
)
/
len
(
te
))
print
"write time:
%2.6
f"
%
float
(
sum
(
twr
)
/
len
(
twr
))
#(t4-t3)
print
"wait time:
%2.6
f"
%
float
(
sum
(
twa
)
/
len
(
twa
))
#(t5-t4)
print
"page write time:
%2.6
f"
%
float
(
sum
(
tp
)
/
len
(
tp
))
print
"total write time:
%2.6
f"
%
float
(
tw1
-
tw0
)
# Finally, issue the reprogramming (IPROG) command
print
"Issuing IPROG command..."
ctb
.
write
(
MB_BASE
+
MB_GBBAR_OFS
,
0x44
|
(
0x0b
<<
24
))
ctb
.
write
(
MB_BASE
+
MB_MBBAR_OFS
,
multiboot_addr
|
(
0x0b
<<
24
))
ctb
.
write
(
MB_BASE
+
MB_CR_OFS
,
0x10000
)
try
:
ctb
.
write
(
0x88
,
0x44
|
(
0x0b
<<
24
))
ctb
.
write
(
0x8c
,
multiboot_addr
|
(
0x0b
<<
24
))
ctb
.
write
(
0x80
,
0x10000
)
ctb
.
write
(
0x80
,
0x20000
)
ctb
.
write
(
MB_BASE
+
MB_CR_OFS
,
0x20000
)
except
NAckError
:
pass
...
...
@@ -307,12 +320,12 @@ if __name__ == "__main__":
# and wait for the FPGA to gracefully respond, or die trying
while
(
1
):
try
:
if
((
ctb
.
read
(
0x4
)
&
0xFFFF
)
==
0x0201
):
print
"IPROG successful!"
break
if
(
time
.
time
()
>=
t1
):
print
"Timeout, IPROG unsuccessful!"
break
if
((
ctb
.
read
(
0x4
)
&
0xFFFF
)
==
0x0200
):
print
"IPROG successful!"
break
except
NAckError
:
continue
...
...
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