mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-24 22:27:10 -04:00
* : Fix PITON_ARIANE define issues * Fix write-back / cache read collision issue in serpent dcache. * Add separate bootrom / device tree for openpiton (hardcoded for 1x1 tile config at the moment). * Bootrom generation update (better compatibility with older python versions), new bootrom for OpenPiton+Ariane. * Fix assertion in icache. * Correct JTAG timing constraints. * Fix parameter type in fpga toplevel (fix #168). * Remove conflicting bootrom from fpga file list. * This flushs the branch predictors when entering exception handlers in order to avoid speculative fetches from virtual addresses (to be improved with PMAs). * Fix byte offset of IPIs in CLINT * Disable DCache flushes on fence for write-through cache (not needed in that case) * Fix blocking assignments in ff process. * Fix register access issue in debug mode, only affects A0 (fix #179). * Fix multiple driver issue in PLIC * Do not assume replicated data in serpent dcache when reading from an NC region. * Another byte offset fix in IPIs (CLINT) * Add AXI64 compliance switch to dcache_mem * Fix genesys 2 constraints * Map serpent atomic requests onto AXI atomic/exclusive transactions. * Cleanup of AXI memory plumbing, add separate AXI adapter module. * Remove unneeded interface signals, increase wbuffer #pending tx * Fix verilator compilation issues in AXI adapter. * Delete unnecessary constraint * Delete duplicate module instance * Update gitlab CI script * Small fixes to make riscv atomics work with serpent_axi_adapter. * Update travis and gitlab-ci scripts * Register b responses for better timing. * Remove fpu div submodule, update Makefile paths and src lists * Constant bits in haltsum reduction must be 1 (AND reduction). * Switch to DTM from riscv-dbg submodule * Further cleanup fixes in AXI/serpent atomics * Bump riscv-dbg version
127 lines
3.2 KiB
Python
Executable file
127 lines
3.2 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
from string import Template
|
|
import argparse
|
|
import os.path
|
|
import sys
|
|
import binascii
|
|
|
|
|
|
parser = argparse.ArgumentParser(description='Convert binary file to verilog rom')
|
|
parser.add_argument('filename', metavar='filename', nargs=1,
|
|
help='filename of input binary')
|
|
|
|
args = parser.parse_args()
|
|
file = args.filename[0];
|
|
|
|
# check that file exists
|
|
if not os.path.isfile(file):
|
|
print("File {} does not exist.".format(filename))
|
|
sys.exit(1)
|
|
|
|
filename = os.path.splitext(file)[0]
|
|
|
|
license = """\
|
|
/* Copyright 2018 ETH Zurich and University of Bologna.
|
|
* Copyright and related rights are licensed under the Solderpad Hardware
|
|
* License, Version 0.51 (the "License"); you may not use this file except in
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
* http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
|
|
* or agreed to in writing, software, hardware and materials distributed under
|
|
* this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations under the License.
|
|
*
|
|
* File: $filename.v
|
|
*
|
|
* Description: Auto-generated bootrom
|
|
*/
|
|
|
|
// Auto-generated code
|
|
"""
|
|
|
|
module = """\
|
|
module $filename (
|
|
input logic clk_i,
|
|
input logic req_i,
|
|
input logic [63:0] addr_i,
|
|
output logic [63:0] rdata_o
|
|
);
|
|
localparam int RomSize = $size;
|
|
|
|
const logic [RomSize-1:0][63:0] mem = {
|
|
$content
|
|
};
|
|
|
|
logic [$$clog2(RomSize)-1:0] addr_q;
|
|
|
|
always_ff @(posedge clk_i) begin
|
|
if (req_i) begin
|
|
addr_q <= addr_i[$$clog2(RomSize)-1+3:3];
|
|
end
|
|
end
|
|
|
|
// this prevents spurious Xes from propagating into
|
|
// the speculative fetch stage of the core
|
|
assign rdata_o = (addr_q < RomSize) ? mem[addr_q] : '0;
|
|
endmodule
|
|
"""
|
|
|
|
c_var = """\
|
|
// Auto-generated code
|
|
|
|
const int reset_vec_size = $size;
|
|
|
|
uint32_t reset_vec[reset_vec_size] = {
|
|
$content
|
|
};
|
|
"""
|
|
|
|
def read_bin():
|
|
|
|
with open(filename + ".img", 'rb') as f:
|
|
rom = binascii.hexlify(f.read())
|
|
rom = map(''.join, zip(rom[::2], rom[1::2]))
|
|
|
|
|
|
# align to 64 bit
|
|
align = (int((len(rom) + 7) / 8 )) * 8;
|
|
|
|
for i in range(len(rom), align):
|
|
rom.append("00")
|
|
|
|
return rom
|
|
|
|
rom = read_bin()
|
|
|
|
""" Generate C header file for simulator
|
|
"""
|
|
with open(filename + ".h", "w") as f:
|
|
rom_str = ""
|
|
# process in junks of 32 bit (4 byte)
|
|
for i in range(0, int(len(rom)/4)):
|
|
rom_str += " 0x" + "".join(rom[i*4:i*4+4][::-1]) + ",\n"
|
|
|
|
# remove the trailing comma
|
|
rom_str = rom_str[:-2]
|
|
|
|
s = Template(c_var)
|
|
f.write(s.substitute(filename=filename, size=int(len(rom)/4), content=rom_str))
|
|
|
|
f.close()
|
|
|
|
""" Generate SystemVerilog bootcode for FPGA and ASIC
|
|
"""
|
|
with open(filename + ".sv", "w") as f:
|
|
rom_str = ""
|
|
# process in junks of 64 bit (8 byte)
|
|
for i in reversed(range(int(len(rom)/8))):
|
|
rom_str += " 64'h" + "".join(rom[i*8+4:i*8+8][::-1]) + "_" + "".join(rom[i*8:i*8+4][::-1]) + ",\n"
|
|
|
|
# remove the trailing comma
|
|
rom_str = rom_str[:-2]
|
|
|
|
f.write(license)
|
|
s = Template(module)
|
|
f.write(s.substitute(filename=filename, size=int(len(rom)/8), content=rom_str))
|
|
|