Skip to content

Commit 2643959

Browse files
authored
Merge pull request #62 from siliconcompiler/fix-spram-gen
correct search order of memories to pick largest width first
2 parents f39a0cd + 065cdd4 commit 2643959

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lambdalib/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def write_la_spram(fout, memories, control_signals=None, la_type='ram'):
2828
else:
2929
memory_inst_map[memory] = info["inst_name"]
3030

31-
selection_table.setdefault(info['AW'], {})[info['DW']] = memory
31+
selection_table.setdefault(info['AW'], {})[int(info['DW'])] = memory
3232

3333
selection_table = OrderedDict(sorted(selection_table.items(), reverse=True))
3434
for aw, items in selection_table.items():

lambdalib/utils/templates/la_spmemory.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module la_sp{{ type }}
4646

4747
// Determine which memory to select
4848
localparam MEM_TYPE = (TYPE != "DEFAULT") ? TYPE :{% for aw, dw_select in selection_table.items() %}
49-
{% if loop.nextitem is defined %}(AW {% if loop.previtem is defined %}=={% else %}>={% endif %} {{ aw }}) ? {% endif %}{% for dw, memory in dw_select.items() %}{% if loop.nextitem is defined %}(DW {% if loop.previtem is defined %}=={% else %}>={% endif %} {{dw}}) ? {% endif %}"{{ memory}}"{% if loop.nextitem is defined %} : {% endif%}{% endfor %}{% if loop.nextitem is defined %} :{% else %};{% endif %}{% endfor %}
49+
{% if loop.nextitem is defined %}(AW {% if loop.previtem is defined %}=={% else %}>={% endif %} {{ aw }}) ? {% endif %}{% for dw, memory in dw_select.items() %}{% if loop.nextitem is defined %}(DW >= {{dw}}) ? {% endif %}"{{ memory}}"{% if loop.nextitem is defined %} : {% endif%}{% endfor %}{% if loop.nextitem is defined %} :{% else %};{% endif %}{% endfor %}
5050

5151
localparam MEM_WIDTH = {% for memory, width in width_table %}
5252
(MEM_TYPE == "{{ memory }}") ? {{ width }} :{% endfor %}

0 commit comments

Comments
 (0)