--- /dev/null
+--
+-- Generated by VASY
+--
+LIBRARY IEEE;
+USE IEEE.std_logic_1164.ALL;
+USE IEEE.numeric_std.ALL;
+
+ENTITY sff1r_x4 IS
+PORT(
+ ck : IN BIT;
+ i : IN BIT;
+ nrst : IN BIT;
+ q : OUT BIT;
+ vdd : IN BIT;
+ vss : IN BIT
+);
+END sff1r_x4;
+
+ARCHITECTURE RTL OF sff1r_x4 IS
+ SIGNAL sff_m : BIT;
+BEGIN
+ q <= sff_m;
+ PROCESS ( ck, nrst )
+ BEGIN
+ IF ((ck = '1') AND ck'EVENT)
+ THEN
+ IF (nrst = '1')
+ THEN sff_m <= i;
+ END IF;
+ END IF;
+ IF ((nrst = '0') AND nrst'EVENT)
+ THEN sff_m <= '0';
+ END IF;
+ END PROCESS;
+END RTL;
ALLIANCEBASE = "../alliance-check-toolkit/cells"
ALLIANCE_LIBS = ['nsxlib', 'niolib']
+yosys_ghdl_template = "ghdl --std=08 -g %s\n"
+yosys_ghdl_footer = """proc
+write_verilog %s.v
+write_ilang %s.il
+"""
+
for libname in ALLIANCE_LIBS:
NSXLIB = "%s/%s" % (ALLIANCEBASE, libname)
os.system("mkdir -p %s" % libname)
+ # yosys ghdl loader script
+ ghdl_txt = "plugin -i ghdl\n"
+
for fname in os.listdir(NSXLIB):
if not fname.endswith(".vbe"):
continue
os.system("cp %s/%s /tmp" % (NSXLIB, fname))
os.system("rm -f /tmp/%s.vhd" % (prefix))
os.system("%s -s -I vbe %s %s" % (VASY_CMD, fname, prefix))
- os.system("cp /tmp/%s.vhd %s/%s.vhdl" % (prefix, libname, prefix))
+ os.system("cp /tmp/%s.vhd %s" % (prefix, libname))
+ # add loader template for this module
+ if fname == 'sff1r_x4.vbe':
+ # don't ask.
+ #ghdl_txt += 'read_verilog freepdk_45/sff1r_x4.v\n'
+ os.system("cp freepdk_45/%s.vhd %s" % (prefix, libname))
+ ghdl_txt += yosys_ghdl_template % prefix
+
+ ghdl_txt += yosys_ghdl_footer % (libname, libname)
+
+ # write out the ghdl script
+ fname = "%s/ghdl.ys" % libname
+ print ("text to %s\n" % fname, ghdl_txt)
+ with open(fname, "w") as f:
+ f.write(ghdl_txt)
--- /dev/null
+#!/usr/bin/env python3
+
+"""builds nsxlib and other VHD files into object files using ghdl
+"""
+
+import os
+import sys
+
+SRC = [('nsxlib', 'vhd'),
+ ('niolib', 'vhd'),
+ ('vst_src', 'vst')]
+
+# make and change to obj dir
+os.system("mkdir -p obj")
+#cwd = os.getcwd()
+#os.chdir("obj")
+
+for srcdir, suffix in SRC:
+ # run ghdl -a on every vhd / vst file
+ for fname in os.listdir("%s" % srcdir):
+ if not fname.endswith(".%s" % suffix):
+ continue
+ print (fname)
+ prefix = fname[:-4] # strip ".vhd"
+ os.system("ghdl -a --std=08 %s/%s" % (srcdir, fname))
+
+# back to original dir
+#os.chdir(cwd)
txt = txt.replace("linkage bit", "in bit")
# and double-underscores
txt = txt.replace("__", "_")
- fname = fname[:-3] + "vhdl"
+ #fname = fname[:-3] + "vhdl"
# write the file
with open(fname, "w") as f:
f.write(txt)