summaryrefslogtreecommitdiffstats
path: root/libtoprammer/main.py
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2012-07-11 12:19:48 +0200
committerMichael Buesch <m@bues.ch>2012-07-11 12:19:48 +0200
commit9f3a34f6ab7d15083663c04ade95b6c317411510 (patch)
tree1b72a3dafd7efce3b2bf32b0d03dfac4f46ebbfa /libtoprammer/main.py
parent7af9d0641e909321741ca3393d0c4245cdffe668 (diff)
downloadtoprammer-9f3a34f6ab7d15083663c04ade95b6c317411510.tar.xz
toprammer-9f3a34f6ab7d15083663c04ade95b6c317411510.zip
Add basic frequency counter to unitest
Signed-off-by: Michael Buesch <m@bues.ch>
Diffstat (limited to 'libtoprammer/main.py')
-rw-r--r--libtoprammer/main.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/libtoprammer/main.py b/libtoprammer/main.py
index a97dbb4..689738a 100644
--- a/libtoprammer/main.py
+++ b/libtoprammer/main.py
@@ -98,16 +98,10 @@ class TOP(object):
top = self,
chipDescription = descriptor,
assignedChipOptions = assignedChipOptions)
- # Find the bitfile for the chip.
- bitfile = bitfileFind(descriptor.bitfile)
- if not bitfile:
+ ok = self.configureFPGA(descriptor.bitfile, descriptor.runtimeID)
+ if not ok:
self.chip = None
raise TOPException("Did not find BIT-file for chip implementation %s" % chipID)
- # Open and parse the bitfile.
- self.bitfile = Bitfile()
- self.bitfile.parseFile(bitfile)
- # Initialize the hardware.
- self.__bitfileUpload(descriptor.runtimeID)
def shutdownChip(self):
if self.chip:
@@ -267,6 +261,21 @@ class TOP(object):
"(Got 0x%04X/0x%02X, but expected 0x%04X/0x%02X)" %\
(gotID, gotRev, requiredID, requiredRevision))
+ def configureFPGA(self, bitfileName, runtimeIDs):
+ """Upload and configure the FPGA.
+ bitfileName -> The name of the bitfile to upload
+ runtimeIDs -> bottom-half ID tuple: (majorID, minorID)"""
+ # Get the bitfile path.
+ bitfilePath = bitfileFind(bitfileName)
+ if not bitfilePath:
+ return False
+ # Open and parse the bitfile.
+ self.bitfile = Bitfile()
+ self.bitfile.parseFile(bitfilePath)
+ # Initialize the hardware.
+ self.__bitfileUpload(runtimeIDs)
+ return True
+
def readSignature(self):
"""Reads the chip signature and returns it."""
self.printDebug("Reading signature from chip...")
bues.ch cgit interface