mirror of https://github.com/VLSIDA/OpenRAM.git
Fixed the bad commas with post-process regex
This commit is contained in:
parent
9bd3f1b45a
commit
5f45f7db15
|
|
@ -1,15 +1,8 @@
|
||||||
from template import template
|
from template import template
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
<<<<<<< HEAD
|
|
||||||
<<<<<<< HEAD
|
|
||||||
import os
|
import os
|
||||||
from math import ceil, log
|
from math import ceil, log
|
||||||
=======
|
import re
|
||||||
>>>>>>> 3dd65b1a (modified template engine & sram multibank class)
|
|
||||||
=======
|
|
||||||
import os
|
|
||||||
from math import ceil, log
|
|
||||||
>>>>>>> 22c01d7f (Multibank file generation (messy))
|
|
||||||
|
|
||||||
|
|
||||||
class sram_multibank:
|
class sram_multibank:
|
||||||
|
|
@ -31,10 +24,17 @@ class sram_multibank:
|
||||||
'data_width': sram.word_size,
|
'data_width': sram.word_size,
|
||||||
'addr_width': sram.bank_addr_size + ceil(log(sram.num_banks, 2)),
|
'addr_width': sram.bank_addr_size + ceil(log(sram.num_banks, 2)),
|
||||||
'bank_sel': ceil(log(sram.num_banks, 2)),
|
'bank_sel': ceil(log(sram.num_banks, 2)),
|
||||||
'num_wmask': sram.num_wmasks
|
'num_wmask': sram.num_wmasks,
|
||||||
|
'write_size': sram.write_size
|
||||||
}
|
}
|
||||||
|
|
||||||
def verilog_write(self, name):
|
def verilog_write(self, name):
|
||||||
template_filename = os.path.join(os.path.abspath(os.environ["OPENRAM_HOME"]), "sram/sram_multibank_template.v")
|
template_filename = os.path.join(os.path.abspath(os.environ["OPENRAM_HOME"]), "sram/sram_multibank_template.v")
|
||||||
t = template(template_filename, self.dict)
|
t = template(template_filename, self.dict)
|
||||||
t.write(name)
|
t.write(name)
|
||||||
|
with open(name, 'r') as f:
|
||||||
|
text = f.read()
|
||||||
|
badComma = re.compile(',(\s*\n\s*\);)')
|
||||||
|
text = badComma.sub(r'\1', text)
|
||||||
|
with open(name, 'w') as f:
|
||||||
|
f.write(text)
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ module {{ module_name }} (
|
||||||
addr{{ port }},
|
addr{{ port }},
|
||||||
din{{ port }},
|
din{{ port }},
|
||||||
csb{{ port }},
|
csb{{ port }},
|
||||||
{% if write_size > 1 %}
|
{% if num_wmask > 1 %}
|
||||||
wmask{{ port }},
|
wmask{{ port }},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
web{{ port }},
|
web{{ port }},
|
||||||
dout{{ port }},
|
dout{{ port }},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -26,9 +26,9 @@ module {{ module_name }} (
|
||||||
addr{{ port }},
|
addr{{ port }},
|
||||||
din{{ port }},
|
din{{ port }},
|
||||||
csb{{ port }},
|
csb{{ port }},
|
||||||
{% if write_size > 1 %}
|
{% if num_wmask > 1 %}
|
||||||
wmask{{ port }},
|
wmask{{ port }},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
web{{ port }},
|
web{{ port }},
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
);
|
);
|
||||||
|
|
@ -49,9 +49,9 @@ module {{ module_name }} (
|
||||||
input [DATA_WIDTH - 1: 0] din{{ port }};
|
input [DATA_WIDTH - 1: 0] din{{ port }};
|
||||||
input csb{{ port }};
|
input csb{{ port }};
|
||||||
input web{{ port }};
|
input web{{ port }};
|
||||||
{% if write_size > 1 %}
|
{% if num_wmask > 1 %}
|
||||||
input [NUM_WMASK - 1 : 0] wmask{{ port }};
|
input [NUM_WMASK - 1 : 0] wmask{{ port }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
output reg [DATA_WIDTH - 1 : 0] dout{{ port }};
|
output reg [DATA_WIDTH - 1 : 0] dout{{ port }};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for port in r_ports %}
|
{% for port in r_ports %}
|
||||||
|
|
@ -66,9 +66,9 @@ module {{ module_name }} (
|
||||||
input [DATA_WIDTH - 1: 0] din{{ port }};
|
input [DATA_WIDTH - 1: 0] din{{ port }};
|
||||||
input csb{{ port }};
|
input csb{{ port }};
|
||||||
input web{{ port }};
|
input web{{ port }};
|
||||||
{% if write_size > 1 %}
|
{% if num_wmask > 1 %}
|
||||||
input [NUM_WMASK - 1 : 0] wmask{{ port }};
|
input [NUM_WMASK - 1 : 0] wmask{{ port }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for port in ports %}
|
{% for port in ports %}
|
||||||
|
|
@ -96,9 +96,9 @@ module {{ module_name }} (
|
||||||
.din{{ port }}(din{{ port }}),
|
.din{{ port }}(din{{ port }}),
|
||||||
.csb{{ port }}(csb{{ port }}_bank{{ bank }}),
|
.csb{{ port }}(csb{{ port }}_bank{{ bank }}),
|
||||||
.web{{ port }}(web{{ port }}_bank{{ bank }}),
|
.web{{ port }}(web{{ port }}_bank{{ bank }}),
|
||||||
{% if write_size > 1 %}
|
{% if num_wmask > 1 %}
|
||||||
.wmask{{ port }}(wmask{{ port }}),
|
.wmask{{ port }}(wmask{{ port }}),
|
||||||
{% endif %}
|
{% endif %}
|
||||||
.dout{{ port }}(dout{{ port }}_bank{{ bank }}),
|
.dout{{ port }}(dout{{ port }}_bank{{ bank }}),
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for port in r_ports %}
|
{% for port in r_ports %}
|
||||||
|
|
@ -112,9 +112,9 @@ module {{ module_name }} (
|
||||||
.addr{{ port }}(addr{{ port }}[ADDR_WIDTH - BANK_SEL - 1 : 0]),
|
.addr{{ port }}(addr{{ port }}[ADDR_WIDTH - BANK_SEL - 1 : 0]),
|
||||||
.din{{ port }}(din{{ port }}),
|
.din{{ port }}(din{{ port }}),
|
||||||
.csb{{ port }}(csb{{ port }}_bank{{ bank }}),
|
.csb{{ port }}(csb{{ port }}_bank{{ bank }}),
|
||||||
{% if write_size > 1 %}
|
{% if num_wmask > 1 %}
|
||||||
.wmask{{ port }}(wmask{{ port }}),
|
.wmask{{ port }}(wmask{{ port }}),
|
||||||
{% endif %}
|
{% endif %}
|
||||||
.web{{ port }}(web{{ port }}_bank{{ bank }}),
|
.web{{ port }}(web{{ port }}_bank{{ bank }}),
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue