import subprocess
import sys
import ctypes
+import time
+import datetime
def language_by_filename(name):
def git_revision():
return subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).strip().decode("utf-8")
+
+def generated_banner(line_comment="//"):
+ r = line_comment + "-"*60 + "\n"
+ r += line_comment + " Generated by Migen & LiteX / "
+ r += git_revision() + " / "
+ r += "{}\n".format(datetime.datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d %H:%M:%S"))
+ r += line_comment + "-"*60 + "\n"
+ return r
\ No newline at end of file
from functools import partial
from operator import itemgetter
import collections
-import time
-import datetime
from migen.fhdl.structure import *
from migen.fhdl.structure import _Operator, _Slice, _Assign, _Fragment
from migen.fhdl.namer import build_namespace
from migen.fhdl.conv_output import ConvOutput
-from litex.build.tools import git_revision
+from litex.build.tools import generated_banner
_reserved_keywords = {
ns.clock_domains = f.clock_domains
r.ns = ns
- src = "//" + "-"*60 + "\n"
- src += "// Generated by Migen & LiteX / ".format(git_revision())
- src += git_revision() + " / "
- src += "{}\n".format(datetime.datetime.fromtimestamp(
- time.time()).strftime("%Y-%m-%d %H:%M:%S"))
- src += "//" + "-"*60 + "\n"
+ src = generated_banner("//")
src += _printheader(f, ios, name, ns, attr_translate,
reg_initialization=reg_initialization)
if regular_comb:
from litex.soc.interconnect.csr import CSRStatus
+from litex.build.tools import generated_banner
+
def get_cpu_mak(cpu):
# select between clang and gcc
clang = os.getenv("CLANG", "")
def get_mem_header(regions, flash_boot_address):
+ r = generated_banner("//")
r = "#ifndef __GENERATED_MEM_H\n#define __GENERATED_MEM_H\n\n"
for name, base, size in regions:
r += "#define {name}_BASE 0x{base:08x}\n#define {name}_SIZE 0x{size:08x}\n\n".format(name=name.upper(), base=base, size=size)
def get_csr_header(regions, constants, with_access_functions=True, with_shadow_base=True, shadow_base=0x80000000):
- r = "#ifndef __GENERATED_CSR_H\n#define __GENERATED_CSR_H\n"
+ r = generated_banner("//")
+ r += "#ifndef __GENERATED_CSR_H\n#define __GENERATED_CSR_H\n"
if with_access_functions:
r += "#include <stdint.h>\n"
r += "#ifdef CSR_ACCESSORS_DEFINED\n"
def get_csr_csv(csr_regions=None, constants=None, memory_regions=None):
- r = ""
+ r = generated_banner("#")
if csr_regions is not None:
for name, origin, busword, obj in csr_regions: