Skip to content

Commit ab33017

Browse files
authored
Merge pull request #282 from ruhai-lin/stable
Attempt to fix LVS mismatch and SRAM creation with banks for sky130
2 parents c99b134 + 6d14626 commit ab33017

File tree

5 files changed

+33
-17
lines changed

5 files changed

+33
-17
lines changed

compiler/characterizer/delay.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,15 @@ def get_delay_lists(self, value_dict):
13881388
def calculate_inverse_address(self):
13891389
"""Determine dummy test address based on probe address and column mux size."""
13901390

1391-
# The inverse address needs to share the same bitlines as the probe address as the trimming will remove all other bitlines
1391+
# The inverse address needs to share the same bitlines as the probe address as the trimming will remove all other bitlines.
13921392
# This is only an issue when there is a column mux and the address maps to different bitlines.
13931393
column_addr = self.get_column_addr() # do not invert this part
13941394
inverse_address = ""
1395-
for c in self.probe_address[self.sram.col_addr_size:]: # invert everything else
1395+
if self.sram.col_addr_size > 0:
1396+
row_address = self.probe_address[:-self.sram.col_addr_size]
1397+
else:
1398+
row_address = self.probe_address
1399+
for c in row_address: # invert row bits only
13961400
if c=="0":
13971401
inverse_address += "1"
13981402
elif c=="1":

compiler/characterizer/simulation.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ def set_probe(self, probe_address, probe_data):
126126
def get_data_bit_column_number(self, probe_address, probe_data):
127127
"""Calculates bitline column number of data bit under test using bit position and mux size"""
128128

129-
if self.sram.col_addr_size>0:
130-
col_address = int(probe_address[0:self.sram.col_addr_size], 2)
129+
# Address pins are ordered a*_0 ... a*_N, where a*_0 is the LSB.
130+
# So the column mux select bits are the rightmost bits in the binary address string.
131+
if self.sram.col_addr_size > 0:
132+
col_address = int(probe_address[-self.sram.col_addr_size:], 2)
131133
else:
132134
col_address = 0
133135
bl_column = int(self.sram.words_per_row * probe_data + col_address)
@@ -136,7 +138,11 @@ def get_data_bit_column_number(self, probe_address, probe_data):
136138
def get_address_row_number(self, probe_address):
137139
"""Calculates wordline row number of data bit under test using address and column mux size"""
138140

139-
return int(probe_address[self.sram.col_addr_size:], 2)
141+
if self.sram.col_addr_size > 0:
142+
row_address = probe_address[:-self.sram.col_addr_size]
143+
else:
144+
row_address = probe_address
145+
return int(row_address, 2) if row_address else 0
140146

141147
def add_control_one_port(self, port, op):
142148
"""Appends control signals for operation to a given port"""
@@ -484,7 +490,9 @@ def gen_pin_names(self, port_signal_names, port_info, abits, dbits):
484490

485491
def get_column_addr(self):
486492
"""Returns column address of probe bit"""
487-
return self.probe_address[:self.sram.col_addr_size]
493+
if self.sram.col_addr_size == 0:
494+
return ""
495+
return self.probe_address[-self.sram.col_addr_size:]
488496

489497
def add_graph_exclusions(self):
490498
"""

compiler/characterizer/trim_spice.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ def trim(self, address, data_bit):
5656
# Always start fresh if we do multiple reductions
5757
self.sp_buffer = self.spice
5858

59-
# Split up the address and convert to an int
60-
wl_address = int(address[self.col_addr_size:], 2)
59+
# Address pins are ordered with bit 0 as LSB, so mux column bits
60+
# are the rightmost bits in the binary address string.
6161
if self.col_addr_size > 0:
62-
col_address = int(address[0:self.col_addr_size], 2)
62+
row_address = address[:-self.col_addr_size]
63+
col_address = int(address[-self.col_addr_size:], 2)
6364
else:
65+
row_address = address
6466
col_address = 0
67+
wl_address = int(row_address, 2) if row_address else 0
6568

6669
# 1. Keep cells in the bitcell array based on WL and BL
6770
wl_name = "wl_{}".format(wl_address)

technology/sky130/custom/sky130_bitcell_base_array.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ def get_col_cap_pins(self, row, col):
100100
strap_pins = []
101101
for port in self.all_ports:
102102
strap_pins.extend([x for x in self.get_bitline_names(port) if "bl" in x and x.endswith("_{0}".format(col))])
103-
strap_pins.extend(["vdd", "gnd"])
104103
for port in self.all_ports:
105104
strap_pins.extend([x for x in self.get_bitline_names(port) if "br" in x and x.endswith("_{0}".format(col))])
105+
# col_cap_1port_bitcell port order:
106+
# [bl, br, vdd, gnd, vpb, vnb, gate]
107+
strap_pins.extend(["vdd", "gnd", "vdd", "gnd"])
106108
if row == 0:
107-
strap_pins.extend(["top_gate"])
109+
strap_pins.append("top_gate")
108110
else:
109-
strap_pins.extend(["bot_gate"])
110-
strap_pins.extend(["vdd", "gnd"])
111+
strap_pins.append("bot_gate")
111112
return strap_pins
112113

113114
def get_row_cap_pins(self, row, col):

technology/sky130/custom/sky130_col_cap_array.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def create_instances(self):
7575
row_layout.append(self.colend1)
7676
self.cell_inst[col]=self.add_inst(name=name, mod=self.colend1)
7777
pins.append("fake_bl_{}".format(bitline))
78+
pins.append("fake_br_{}".format(bitline))
7879
pins.append("vdd")
7980
pins.append("gnd")
80-
pins.append("fake_br_{}".format(bitline))
81-
pins.append("gate")
8281
pins.append("vdd")
8382
pins.append("gnd")
83+
pins.append("gate")
8484
bitline += 1
8585
elif col % 4 == 1:
8686
row_layout.append(self.colend2)
@@ -92,12 +92,12 @@ def create_instances(self):
9292
row_layout.append(self.colend1)
9393
self.cell_inst[col]=self.add_inst(name=name, mod=self.colend1)
9494
pins.append("fake_bl_{}".format(bitline))
95+
pins.append("fake_br_{}".format(bitline))
9596
pins.append("vdd")
9697
pins.append("gnd")
97-
pins.append("fake_br_{}".format(bitline))
98-
pins.append("gate")
9998
pins.append("vdd")
10099
pins.append("gnd")
100+
pins.append("gate")
101101
bitline += 1
102102
elif col % 4 ==3:
103103
row_layout.append(self.colend2)

0 commit comments

Comments
 (0)