Skip to content

Commit adb92e2

Browse files
committed
FPGA breakout support
1 parent 0fedc59 commit adb92e2

File tree

7 files changed

+484
-13
lines changed

7 files changed

+484
-13
lines changed

src/ttboard/boot/demoboard_detect.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def to_string(cls, v:int):
3131
if v in asStr:
3232
return asStr[v]
3333
return 'N/A'
34+
35+
class DemoboardCarrier:
36+
UNKNOWN = 0
37+
TT_CARRIER = 1
38+
FPGA = 2
39+
3440

3541
class DemoboardDetect:
3642
'''
@@ -88,7 +94,16 @@ def probe_pullups(cls):
8894
log.info("TT06+ demoboard with carrier present")
8995
cls.PCB = DemoboardVersion.TT06
9096
cls.CarrierPresent = True
97+
cls.CarrierVersion = DemoboardCarrier.TT_CARRIER
98+
return True
99+
100+
if (crst) and (not cena):
101+
log.info("ctrl mux lines pulled to indicate TT06+ compatible FPGA board")
102+
cls.PCB = DemoboardVersion.TT06
103+
cls.CarrierPresent = True
104+
cls.CarrierVersion = DemoboardCarrier.FPGA
91105
return True
106+
92107

93108
if crst and cena:
94109
log.info("probing ctrl mux lines gives no info, unable to determine db version")
@@ -113,6 +128,7 @@ def probe_tt04mux(cls):
113128
if mux_1 != mux_0:
114129
log.info("DB seems to have on-board MUX: TT04+")
115130
cls.PCB = DemoboardVersion.TT04
131+
cls.CarrierVersion = DemoboardCarrier.TT_CARRIER
116132
return True
117133

118134
log.debug("Mux twiddle has no effect, probably not TT04 db")

src/ttboard/boot/rom.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import ttboard.util.time as time
99
from ttboard.boot.shuttle_properties import ShuttleProperties
10+
from ttboard.boot.demoboard_detect import DemoboardDetect, DemoboardCarrier
1011

1112

1213
import ttboard.log as logging
@@ -55,14 +56,24 @@ def contents(self):
5556
if self._contents is not None:
5657
return self._contents
5758

58-
# select project 0
59-
self.project_mux.reset_and_clock_mux(0)
60-
6159
self._contents = {
6260
'shuttle': 'unknown',
6361
'repo': '',
6462
'commit': ''
6563
}
64+
if not DemoboardDetect.CarrierPresent:
65+
log.warn("No carrier present, skipping chiprom")
66+
return self._contents
67+
68+
if DemoboardDetect.CarrierVersion != DemoboardCarrier.TT_CARRIER:
69+
if DemoboardDetect.CarrierVersion == DemoboardCarrier.FPGA:
70+
self._contents['shuttle'] = 'FPGA'
71+
72+
return self._contents
73+
74+
# select project 0
75+
self.project_mux.reset_and_clock_mux(0)
76+
6677

6778
# list of expected outputs as
6879
# (SEND, RCV)

src/ttboard/demoboard.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from ttboard.project_mux import Design
2424
from ttboard.config.user_config import UserConfig
2525
import ttboard.util.platform as platform
26-
from ttboard.boot.demoboard_detect import DemoboardDetect, DemoboardVersion
26+
from ttboard.boot.demoboard_detect import DemoboardDetect, DemoboardVersion, DemoboardCarrier
2727

2828
import ttboard.log as logging
2929
log = logging.getLogger(__name__)
@@ -101,15 +101,20 @@ def __init__(self,
101101
if log_level is not None:
102102
logging.basicConfig(level=log_level)
103103

104-
if mode is not None:
105-
self.default_mode = mode
104+
if DemoboardDetect.CarrierVersion == DemoboardCarrier.FPGA:
105+
log.info(f'Demoboard hosting an FPGA, setting mode to manual inputs')
106+
mode = RPMode.ASIC_MANUAL_INPUTS
106107
else:
107-
self.default_mode = self.user_config.default_mode
108-
if self.default_mode is None:
109-
# neither arg and ini file specify mode
110-
raise AttributeError('MUST specify either mode in .ini DEFAULT or mode argument')
108+
if mode is not None:
109+
self.default_mode = mode
110+
else:
111+
self.default_mode = self.user_config.default_mode
112+
if self.default_mode is None:
113+
# neither arg and ini file specify mode
114+
raise AttributeError('MUST specify either mode in .ini DEFAULT or mode argument')
115+
116+
mode = self.default_mode
111117

112-
mode = self.default_mode
113118

114119
log.info(f'Demoboard starting up in mode {RPMode.to_string(mode)}')
115120

src/ttboard/fpga/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)