Skip to content

Commit

Permalink
WIP: add BEL to use for specific inputs when driven by specific cells
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Comodi <[email protected]>
  • Loading branch information
acomodi committed May 27, 2021
1 parent 8ea36fb commit bce222b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 35 deletions.
59 changes: 37 additions & 22 deletions fpga_interchange/chip_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,29 +698,55 @@ def append_bba(self, bba, label_prefix):
bba.u32(1)


class ChainDriverPortBel():
def __init__(self, name, bel):
self.name = name
self.bel = bel

def field_label(self, label_prefix, field):
prefix = '{}.{}.{}'.format(label_prefix, self.name, field)
return prefix

def append_children_bba(self, bba, label_prefix):
pass

def append_bba(self, bba, label_prefix):
bba.str_id(self.name)
bba.str_id(self.bel)


class ChainDriver():
def __init__(self, ports, bels):
self.ports = ports
self.bels = bels
def __init__(self, ports, cells):
self.ports = []
self.cells = cells

for port in ports:
self.ports.append(ChainDriverPortBel(port.name, port.bel))

def field_label(self, label_prefix, field):
prefix = '{}.{}'.format(label_prefix, field)
return prefix

def append_children_bba(self, bba, label_prefix):
bba.label(self.field_label(label_prefix, 'ports'), 'constids')
label = self.field_label(label_prefix, 'ports')
for port in self.ports:
bba.str_id(port)
bba.label(self.field_label(label_prefix, 'bels'), 'constids')
for bel in self.bels:
bba.str_id(bel)
port.append_children_bba(bba, label)

bba.label(label, 'ChainDriverPortBelPOD')
for port in self.ports:
port.append_bba(bba, label)

bba.label(self.field_label(label_prefix, 'cells'), 'constids')
for cell in self.cells:
bba.str_id(cell)

def append_bba(self, bba, label_prefix):
bba.ref(self.field_label(label_prefix, 'ports'))
bba.u32(len(self.ports))

bba.ref(self.field_label(label_prefix, 'bels'))
bba.u32(len(self.bels))
bba.ref(self.field_label(label_prefix, 'cells'))
bba.u32(len(self.cells))


class ChainCoordConfig():
def __init__(self, coord, step):
Expand All @@ -736,17 +762,6 @@ def append_bba(self, bba, label_prefix):
bba.u16(0)


class ChainCell():
def __init__(self, cell, input_pins, output_pins):
self.cell = cell

def append_children_bba(self, bba, label_prefix):
pass

def append_bba(self, bba, label_prefix):
bba.str_id(self.cell)


class BelChain():
children_fields = [
'patterns', 'coord_configs', 'chain_drivers'
Expand Down Expand Up @@ -780,7 +795,7 @@ def __init__(self, name, patterns, sites, coord_configs, cells, chain_drivers):
self.chain_drivers = []
if chain_drivers is not None:
for driver in chain_drivers:
self.chain_drivers.append(ChainDriver(driver.ports, driver.bels))
self.chain_drivers.append(ChainDriver(driver.ports, driver.cells))

def field_label(self, label_prefix, field):
prefix = '{}.{}.{}'.format(label_prefix, self.name, field)
Expand Down
37 changes: 24 additions & 13 deletions test_data/series7_bel_chains.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
belChains:
- name: carryChain
patterns:
- {source: {type: "CARRY4", port: "CO[3]"}, sink: {type: "CARRY4", port: "CI"}}
sites:
- SLICEL
- SLICEM
- name: carryChain
patterns:
- {source: {type: "CARRY4", port: "CO[3]"}, sink: {type: "CARRY4", port: "CI"}}
sites:
- SLICEL
- SLICEM
cells:
- CARRY4
chainDrivers: # Place driver cell of S port to a proper BEL
- ports:
- name: S[0]
bel: AFF
- name: S[1]
bel: BFF
- name: S[2]
bel: CFF
- name: S[3]
bel: DFF
cells:
- CARRY4
chainDrivers: # Place driver cell of S port to a proper BEL
- {ports: ["S[0]", "S[1]", "S[2]", "S[3]"],
bels: ["LUT6", "LUT_OR_MEM6"]}
coordConfigs:
- {coord: y, step: -1} # Default
- {coord: y, step: -2} # When crossing clock region
- FDRE
- FDSE
- FDCE
coordConfigs:
- {coord: y, step: -1} # Default
- {coord: y, step: -2} # When crossing clock region

0 comments on commit bce222b

Please sign in to comment.