Skip to content

Commit 2e46b25

Browse files
committedJan 16, 2021
Added PAL12L6, PAL16R4/6/8
1 parent a9efc84 commit 2e46b25

File tree

1 file changed

+206
-36
lines changed

1 file changed

+206
-36
lines changed
 

‎jedisasm.py

+206-36
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,113 @@ def get_input_names(self):
112112
def get_macrocell_cmt(self, config):
113113
return []
114114

115-
class P16L8(PALBase):
116-
"""
117-
PAL16L8
118-
"""
115+
class P16xx(PALBase):
119116
pin_count = 20
120117

121118
class OLMC:
122-
def __init__(self, pin, oe_fuses, terms_fuses):
119+
def __init__(self, pin, oe_fuses, terms_fuses, registered):
123120
self.pin = pin
124121
self.oe_fuses = oe_fuses
125122
self.terms_fuses = terms_fuses
123+
self.registered = registered
124+
125+
def is_out_inverted(self, pin):
126+
for config in self.macrocell_config:
127+
if config.pin == pin:
128+
break
129+
else:
130+
return False
131+
return config.registered or is_term_nonzero(self.fusemap, config.oe_fuses)
132+
133+
def get_macrocell_eqns(self, config):
134+
if config.registered:
135+
return self.get_registered_macrocell_eqns(config)
136+
else:
137+
return self.get_combinatorial_macrocell_eqns(config)
138+
139+
def get_combinatorial_macrocell_eqns(self, config):
140+
eqns = []
141+
name = self.get_pin_name(config.pin)
142+
if config.oe_fuses and is_term_nonzero(self.fusemap, config.oe_fuses):
143+
oe_terms = collect_and_terms(self.fusemap, config.oe_fuses)
144+
if oe_terms:
145+
eqns.append((name+".oe", oe_terms))
146+
d_terms = ORList()
147+
for term_fuses in config.terms_fuses:
148+
if is_term_nonzero(self.fusemap, term_fuses):
149+
terms = collect_and_terms(self.fusemap, term_fuses)
150+
if terms:
151+
d_terms.append(terms)
152+
if d_terms:
153+
eqns.append((name, d_terms))
154+
return eqns
155+
156+
def get_registered_macrocell_eqns(self, config):
157+
eqns = []
158+
name = self.get_pin_name(config.pin)
159+
d_terms = ORList()
160+
if config.oe_fuses and is_term_nonzero(self.fusemap, config.oe_fuses):
161+
terms = collect_and_terms(self.fusemap, config.oe_fuses)
162+
if terms:
163+
d_terms.append(terms)
164+
for term_fuses in config.terms_fuses:
165+
if is_term_nonzero(self.fusemap, term_fuses):
166+
terms = collect_and_terms(self.fusemap, term_fuses)
167+
if terms:
168+
d_terms.append(terms)
169+
if d_terms:
170+
eqns.append((name+".d", d_terms))
171+
return eqns
126172

173+
class P12L6(P16xx):
174+
"""
175+
PAL12L6
176+
"""
177+
OLMC = P16xx.OLMC
127178
macrocell_config = [
128-
OLMC(19, ( 0, 32), [(s, s+32) for s in range( 32, 256, 32)]),
129-
OLMC(18, ( 256, 288), [(s, s+32) for s in range( 288, 512, 32)]),
130-
OLMC(17, ( 512, 544), [(s, s+32) for s in range( 544, 768, 32)]),
131-
OLMC(16, ( 768, 800), [(s, s+32) for s in range( 800, 1024, 32)]),
132-
OLMC(15, (1024, 1056), [(s, s+32) for s in range(1056, 1280, 32)]),
133-
OLMC(14, (1280, 1312), [(s, s+32) for s in range(1312, 1536, 32)]),
134-
OLMC(13, (1536, 1568), [(s, s+32) for s in range(1568, 1792, 32)]),
135-
OLMC(12, (1792, 1824), [(s, s+32) for s in range(1824, 2048, 32)]),
179+
OLMC(18, None, [(s, s+24) for s in range( 0, 96, 24)], False),
180+
OLMC(17, None, [(s, s+24) for s in range( 96, 144, 24)], False),
181+
OLMC(16, None, [(s, s+24) for s in range( 144, 192, 24)], False),
182+
OLMC(15, None, [(s, s+24) for s in range( 192, 240, 24)], False),
183+
OLMC(14, None, [(s, s+24) for s in range( 240, 288, 24)], False),
184+
OLMC(13, None, [(s, s+24) for s in range( 288, 384, 24)], False),
185+
]
186+
187+
def get_input_map(self):
188+
return [
189+
( 2, False),
190+
( 1, False),
191+
( 3, False),
192+
(19, False),
193+
( 4, False),
194+
( 5, False),
195+
( 6, False),
196+
( 7, False),
197+
( 8, False),
198+
(12, False),
199+
( 9, False),
200+
(11, False)]
201+
202+
def is_out_inverted(self, pin):
203+
for config in self.macrocell_config:
204+
if config.pin == pin:
205+
return True
206+
return False
207+
208+
class P16L8(P16xx):
209+
"""
210+
PAL16L8
211+
"""
212+
OLMC = P16xx.OLMC
213+
macrocell_config = [
214+
OLMC(19, ( 0, 32), [(s, s+32) for s in range( 32, 256, 32)], False),
215+
OLMC(18, ( 256, 288), [(s, s+32) for s in range( 288, 512, 32)], False),
216+
OLMC(17, ( 512, 544), [(s, s+32) for s in range( 544, 768, 32)], False),
217+
OLMC(16, ( 768, 800), [(s, s+32) for s in range( 800, 1024, 32)], False),
218+
OLMC(15, (1024, 1056), [(s, s+32) for s in range(1056, 1280, 32)], False),
219+
OLMC(14, (1280, 1312), [(s, s+32) for s in range(1312, 1536, 32)], False),
220+
OLMC(13, (1536, 1568), [(s, s+32) for s in range(1568, 1792, 32)], False),
221+
OLMC(12, (1792, 1824), [(s, s+32) for s in range(1824, 2048, 32)], False),
136222
]
137223

138224
def get_input_map(self):
@@ -154,30 +240,110 @@ def get_input_map(self):
154240
( 9, False),
155241
(11, False)]
156242

157-
def is_out_inverted(self, pin):
158-
for config in self.macrocell_config:
159-
if config.pin == pin:
160-
break
161-
else:
162-
return False
163-
return is_term_nonzero(self.fusemap, config.oe_fuses)
243+
class P16R4(P16xx):
244+
"""
245+
PAL16R4
246+
"""
247+
OLMC = P16xx.OLMC
248+
macrocell_config = [
249+
OLMC(19, ( 0, 32), [(s, s+32) for s in range( 32, 256, 32)], False),
250+
OLMC(18, ( 256, 288), [(s, s+32) for s in range( 288, 512, 32)], False),
251+
OLMC(17, ( 512, 544), [(s, s+32) for s in range( 544, 768, 32)], True),
252+
OLMC(16, ( 768, 800), [(s, s+32) for s in range( 800, 1024, 32)], True),
253+
OLMC(15, (1024, 1056), [(s, s+32) for s in range(1056, 1280, 32)], True),
254+
OLMC(14, (1280, 1312), [(s, s+32) for s in range(1312, 1536, 32)], True),
255+
OLMC(13, (1536, 1568), [(s, s+32) for s in range(1568, 1792, 32)], False),
256+
OLMC(12, (1792, 1824), [(s, s+32) for s in range(1824, 2048, 32)], False),
257+
]
164258

165-
def get_macrocell_eqns(self, config):
166-
eqns = []
167-
name = self.get_pin_name(config.pin)
168-
if is_term_nonzero(self.fusemap, config.oe_fuses):
169-
oe_terms = collect_and_terms(self.fusemap, config.oe_fuses)
170-
if oe_terms:
171-
eqns.append((name+".oe", oe_terms))
172-
d_terms = ORList()
173-
for term_fuses in config.terms_fuses:
174-
if is_term_nonzero(self.fusemap, term_fuses):
175-
terms = collect_and_terms(self.fusemap, term_fuses)
176-
if terms:
177-
d_terms.append(terms)
178-
if d_terms:
179-
eqns.append((name, d_terms))
180-
return eqns
259+
def get_input_map(self):
260+
return [
261+
( 2, False),
262+
(19, self.is_out_inverted(19)),
263+
( 3, False),
264+
(18, self.is_out_inverted(18)),
265+
( 4, False),
266+
(17, self.is_out_inverted(17)),
267+
( 5, False),
268+
(16, self.is_out_inverted(16)),
269+
( 6, False),
270+
(15, self.is_out_inverted(15)),
271+
( 7, False),
272+
(14, self.is_out_inverted(14)),
273+
( 8, False),
274+
(13, self.is_out_inverted(13)),
275+
( 9, False),
276+
(12, self.is_out_inverted(12))]
277+
278+
class P16R6(P16xx):
279+
"""
280+
PAL16R6
281+
"""
282+
OLMC = P16xx.OLMC
283+
macrocell_config = [
284+
OLMC(19, ( 0, 32), [(s, s+32) for s in range( 32, 256, 32)], False),
285+
OLMC(18, ( 256, 288), [(s, s+32) for s in range( 288, 512, 32)], True),
286+
OLMC(17, ( 512, 544), [(s, s+32) for s in range( 544, 768, 32)], True),
287+
OLMC(16, ( 768, 800), [(s, s+32) for s in range( 800, 1024, 32)], True),
288+
OLMC(15, (1024, 1056), [(s, s+32) for s in range(1056, 1280, 32)], True),
289+
OLMC(14, (1280, 1312), [(s, s+32) for s in range(1312, 1536, 32)], True),
290+
OLMC(13, (1536, 1568), [(s, s+32) for s in range(1568, 1792, 32)], True),
291+
OLMC(12, (1792, 1824), [(s, s+32) for s in range(1824, 2048, 32)], False),
292+
]
293+
294+
def get_input_map(self):
295+
return [
296+
( 2, False),
297+
(19, self.is_out_inverted(19)),
298+
( 3, False),
299+
(18, self.is_out_inverted(18)),
300+
( 4, False),
301+
(17, self.is_out_inverted(17)),
302+
( 5, False),
303+
(16, self.is_out_inverted(16)),
304+
( 6, False),
305+
(15, self.is_out_inverted(15)),
306+
( 7, False),
307+
(14, self.is_out_inverted(14)),
308+
( 8, False),
309+
(13, self.is_out_inverted(13)),
310+
( 9, False),
311+
(12, self.is_out_inverted(12))]
312+
313+
class P16R8(P16xx):
314+
"""
315+
PAL16R8
316+
"""
317+
OLMC = P16xx.OLMC
318+
macrocell_config = [
319+
OLMC(19, ( 0, 32), [(s, s+32) for s in range( 32, 256, 32)], True),
320+
OLMC(18, ( 256, 288), [(s, s+32) for s in range( 288, 512, 32)], True),
321+
OLMC(17, ( 512, 544), [(s, s+32) for s in range( 544, 768, 32)], True),
322+
OLMC(16, ( 768, 800), [(s, s+32) for s in range( 800, 1024, 32)], True),
323+
OLMC(15, (1024, 1056), [(s, s+32) for s in range(1056, 1280, 32)], True),
324+
OLMC(14, (1280, 1312), [(s, s+32) for s in range(1312, 1536, 32)], True),
325+
OLMC(13, (1536, 1568), [(s, s+32) for s in range(1568, 1792, 32)], True),
326+
OLMC(12, (1792, 1824), [(s, s+32) for s in range(1824, 2048, 32)], True),
327+
]
328+
329+
def get_input_map(self):
330+
return [
331+
( 2, False),
332+
(19, self.is_out_inverted(19)),
333+
( 3, False),
334+
(18, self.is_out_inverted(18)),
335+
( 4, False),
336+
(17, self.is_out_inverted(17)),
337+
( 5, False),
338+
(16, self.is_out_inverted(16)),
339+
( 6, False),
340+
(15, self.is_out_inverted(15)),
341+
( 7, False),
342+
(14, self.is_out_inverted(14)),
343+
( 8, False),
344+
(13, self.is_out_inverted(13)),
345+
( 9, False),
346+
(12, self.is_out_inverted(12))]
181347

182348
class G16V8xx(PALBase):
183349
"""
@@ -454,6 +620,10 @@ def read_pin_map(path):
454620
"G16V8MA": G16V8MA,
455621
"G16V8MS": G16V8MS,
456622
"PALCE16V8": G16V8,
623+
"P12L6": P12L6,
624+
"P16R4": P16R4,
625+
"P16R6": P16R6,
626+
"P16R8": P16R8,
457627
"P16L8": P16L8,
458628
"PAL16L8": P16L8,
459629
}

0 commit comments

Comments
 (0)
Please sign in to comment.