From 5000da993e5d83bc4306a556da4ccc254145bd31 Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 00:15:25 +0530
Subject: Restructured Verilator libraries
---
src/maker/Maker.py | 2 +-
src/maker/ModelGeneration.py | 31 +++++++++++-----
src/maker/NgVeri.py | 24 +++++++++---
src/maker/lint_off.txt | 29 ---------------
src/maker/tlv/clk_gate.v | 40 --------------------
src/maker/tlv/pseudo_rand.m4out.tlv | 69 ----------------------------------
src/maker/tlv/pseudo_rand.sv | 70 -----------------------------------
src/maker/tlv/pseudo_rand_gen.sv | 46 -----------------------
src/maker/tlv/sandpiper.vh | 72 ------------------------------------
src/maker/tlv/sandpiper_gen.vh | 4 --
src/maker/tlv/sp_default.vh | 66 ---------------------------------
src/maker/verilated.o | Bin 144712 -> 0 bytes
12 files changed, 41 insertions(+), 412 deletions(-)
delete mode 100755 src/maker/lint_off.txt
delete mode 100755 src/maker/tlv/clk_gate.v
delete mode 100755 src/maker/tlv/pseudo_rand.m4out.tlv
delete mode 100755 src/maker/tlv/pseudo_rand.sv
delete mode 100755 src/maker/tlv/pseudo_rand_gen.sv
delete mode 100755 src/maker/tlv/sandpiper.vh
delete mode 100755 src/maker/tlv/sandpiper_gen.vh
delete mode 100755 src/maker/tlv/sp_default.vh
delete mode 100755 src/maker/verilated.o
(limited to 'src/maker')
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index f4c696f6..78fd13b2 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -228,7 +228,7 @@ class Maker(QtWidgets.QWidget):
code = code.replace(" reg ", " ")
vlog_ex = vlog.VerilogExtractor()
vlog_mods = vlog_ex.extract_objects_from_source(code)
- lint_off = open("../maker/lint_off.txt").readlines()
+ lint_off = open(init_path + "library/tlv/lint_off.txt").readlines()
string = '''\\TLV_version 1d: tl-x.org\n\\SV\n'''
for item in lint_off:
string += "/* verilator lint_off " + \
diff --git a/src/maker/ModelGeneration.py b/src/maker/ModelGeneration.py
index caafe3c8..e7bbe9c9 100755
--- a/src/maker/ModelGeneration.py
+++ b/src/maker/ModelGeneration.py
@@ -106,12 +106,15 @@ class ModelGeneration(QtWidgets.QWidget):
# This function is call the sandpiper to convert .tlv file to .sv file
def sandpiper(self):
+ init_path = '../../'
+ if os.name == 'nt':
+ init_path = ''
# Text="Running Sandpiper............"
print("Running Sandpiper-Saas for TLV to SV Conversion")
- self.cmd = "cp ../maker/tlv/clk_gate.v ../maker/tlv/pseudo_rand.sv \
-../maker/tlv/sandpiper.vh ../maker/tlv/sandpiper_gen.vh \
-../maker/tlv/sp_default.vh ../maker/tlv/pseudo_rand_gen.sv \
-../maker/tlv/pseudo_rand.m4out.tlv " + self.file + " " + self.modelpath
+ self.cmd = "cp " + init_path + "library/tlv/clk_gate.v " + init_path + "library/tlv/pseudo_rand.sv "\
+ + init_path + "library/tlv/sandpiper.vh " + init_path + "library/tlv/sandpiper_gen.vh "\
+ + init_path + "library/tlv/sp_default.vh " + init_path + "library/tlv/pseudo_rand_gen.sv "\
+ + init_path + "library/tlv/pseudo_rand.m4out.tlv " + self.file + " " + self.modelpath
self.process = QtCore.QProcess(self)
self.args = ['-c', self.cmd]
@@ -790,8 +793,12 @@ and set the load for input ports */
# This function is used to run the Verilator using the verilator commands
def run_verilator(self):
+ init_path = '../../'
+ if os.name == 'nt':
+ init_path = ''
+
self.cur_dir = os.getcwd()
- file = open("../maker/lint_off.txt").readlines()
+ file = open(init_path + "library/tlv/lint_off.txt").readlines()
wno = " "
for item in file:
wno += " -Wno-" + item.strip("\n")
@@ -823,10 +830,14 @@ and set the load for input ports */
self.cur_dir = os.getcwd()
print("Make Verilator.............")
os.chdir(self.modelpath)
+
+ if os.path.exists(self.modelpath + "../verilated.o"):
+ os.remove(self.modelpath + "../verilated.o")
+
self.cmd = "make -f V" + self.fname.split('.')[0]\
+ ".mk V" + self.fname.split(
'.')[0] + "__ALL.a sim_main_" \
- + self.fname.split('.')[0] + ".o verilated.o"
+ + self.fname.split('.')[0] + ".o ../verilated.o"
self.process = QtCore.QProcess(self)
self.process.readyReadStandardOutput.connect(self.readAllStandard)
self.process.start('sh', ['-c', self.cmd])
@@ -861,9 +872,9 @@ and set the load for input ports */
os.remove(path_icm + "sim_main_" + self.fname.split('.')[0] + ".o")
if os.path.exists(
self.release_home +
- "src/xspice/icm/" +
+ "src/xspice/icm/Ngveri/" +
"verilated.o"):
- os.remove(self.release_home + "src/xspice/icm/" + "verilated.o")
+ os.remove(self.release_home + "src/xspice/icm/Ngveri/" + "verilated.o")
if os.path.exists(
path_icm +
"V" +
@@ -886,8 +897,8 @@ and set the load for input ports */
self.termtext("Current Directory: " + self.modelpath)
self.termtext("Command: " + self.cmd)
self.process.waitForFinished(50000)
- self.cmd = "cp verilated.o " + self.release_home \
- + "/src/xspice/icm/"
+ self.cmd = "cp ../verilated.o " + self.release_home \
+ + "/src/xspice/icm/Ngveri/"
self.process.start('sh', ['-c', self.cmd])
self.termtext("Command: " + self.cmd)
self.process \
diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py
index d26c9338..5f0e1bcb 100755
--- a/src/maker/NgVeri.py
+++ b/src/maker/NgVeri.py
@@ -252,6 +252,10 @@ class NgVeri(QtWidgets.QWidget):
# This is to remove lint_off comments needed by the verilator warnings
# This function writes to the lint_off.txt here in the same folder
def lint_off_edit(self, text):
+ init_path = '../../'
+ if os.name == 'nt':
+ init_path = ''
+
if text == "Edit lint_off":
return
index = self.entry_var[2].findText(text)
@@ -260,17 +264,18 @@ class NgVeri(QtWidgets.QWidget):
ret = QtWidgets.QMessageBox.warning(
None,
"Warning",
- '''Do you want to remove the lint off error:''' +
+ '''Do you want to remove the lint off error: ''' +
text,
QtWidgets.QMessageBox.Ok,
QtWidgets.QMessageBox.Cancel)
+
if ret == QtWidgets.QMessageBox.Ok:
- file = open("../maker/lint_off.txt", 'r')
+ file = open(init_path + "library/tlv/lint_off.txt", 'r')
data = file.readlines()
file.close()
data.remove(text + "\n")
- file = open("../maker/lint_off.txt", 'w')
+ file = open(init_path + "library/tlv/lint_off.txt", 'w')
for item in data:
file.write(item)
return
@@ -281,11 +286,15 @@ class NgVeri(QtWidgets.QWidget):
# This is to add lint_off comments needed by the verilator warnings
# This function writes to the lint_off.txt here in the same folder
def add_lint_off(self):
+ init_path = '../../'
+ if os.name == 'nt':
+ init_path = ''
+
text = self.entry_var[3].text()
if self.entry_var[2].findText(text) == -1:
self.entry_var[2].addItem(text)
- file = open("../maker/lint_off.txt", 'a+')
+ file = open(init_path + "library/tlv/lint_off.txt", 'a+')
file.write(text + "\n")
file.close()
self.entry_var[3].setText("")
@@ -325,7 +334,12 @@ class NgVeri(QtWidgets.QWidget):
self.count += 1
self.entry_var[self.count] = QtWidgets.QComboBox()
self.entry_var[self.count].addItem("Edit lint_off")
- self.lint_off = open("../maker/lint_off.txt", 'r')
+
+ init_path = '../../'
+ if os.name == 'nt':
+ init_path = ''
+ self.lint_off = open(init_path + "library/tlv/lint_off.txt", 'r')
+
self.data = self.lint_off.readlines()
self.lint_off.close()
for item in self.data:
diff --git a/src/maker/lint_off.txt b/src/maker/lint_off.txt
deleted file mode 100755
index 5d4b7f0a..00000000
--- a/src/maker/lint_off.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-UNUSED
-DECLFILENAME
-BLKSEQ
-WIDTH
-SELRANGE
-PINCONNECTEMPTY
-DEFPARAM
-IMPLICIT
-COMBDLY
-SYNCASYNCNET
-UNOPTFLAT
-UNSIGNED
-CASEINCOMPLETE
-UNDRIVEN
-VARHIDDEN
-CASEX
-CASEOVERLAP
-PINMISSING
-LATCH
-BLKANDNBLK
-MULTIDRIVEN
-NULLPORT
-EOFNEWLINE
-WIDTHCONCAT
-ASSIGNDLY
-MODDUP
-STMTDLY
-LITENDIAN
-INITIALDLY
diff --git a/src/maker/tlv/clk_gate.v b/src/maker/tlv/clk_gate.v
deleted file mode 100755
index 77e9186d..00000000
--- a/src/maker/tlv/clk_gate.v
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright (c) 2015, Steven F. Hoover
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * The name of Steven F. Hoover
- may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-`include "sp_default.vh"
-/* verilator lint_off LATCH */
-
-// Clock gate module used by SandPiper default project.
-
-module clk_gate (output gated_clk, input free_clk, func_en, pwr_en, gating_override);
- wire clk_en;
- reg latched_clk_en /*verilator clock_enable*/;
- assign clk_en = func_en & (pwr_en | gating_override);
- `TLV_BLATCH(latched_clk_en, clk_en, free_clk)
- assign gated_clk = latched_clk_en & free_clk;
-endmodule
-
diff --git a/src/maker/tlv/pseudo_rand.m4out.tlv b/src/maker/tlv/pseudo_rand.m4out.tlv
deleted file mode 100755
index cb0d6149..00000000
--- a/src/maker/tlv/pseudo_rand.m4out.tlv
+++ /dev/null
@@ -1,69 +0,0 @@
-\m4_TLV_version 1b: tl-x.org
-\SV
-/*
-Copyright (c) 2014, Steven F. Hoover
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * The name of Steven F. Hoover
- may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-module pseudo_rand
- #(parameter WIDTH=257) // Random vector width, to a max of 257.
- (input logic clk,
- input logic reset,
- output logic [WIDTH-1:0] rand_vect
- );
-
-// Currently, this implements a Galois LFSR.
-// TODO: It should be XORed with something else so it doesn't just shift.
-// Using polynomials with maximal number of taps would have less regular shifting behavior.
-
-// Bits are numbered in the reverse of the traditional order. This puts the taps in the lower bit positions.
-
-// Choose optimal parameters for given WIDTH.
-localparam LFSR_WIDTH =
- (WIDTH <= 64) ? 64 :
- (WIDTH <= 128) ? 128 :
- (WIDTH <= 257) ? 257 : 0; // 257 enables a large non-power of two for replication on an irregular boundary.
-// Polynomial source: http://www.eej.ulst.ac.uk/~ian/modules/EEE515/files/old_files/lfsr/lfsr_table.pdf
-localparam [LFSR_WIDTH-1:0] LFSR_POLY = {{(LFSR_WIDTH-8){1'b0}},
- (LFSR_WIDTH == 64) ? 8'b00011011 :
- (LFSR_WIDTH == 128) ? 8'b10000111 :
- (LFSR_WIDTH == 257) ? 8'b11000101 : 8'b0};
-
-bit [256:0] SEED = 257'h0_7163e168_713d5431_6684e132_5cd84848_f3048b46_76874654_0c45f864_04e4684a;
-
-
-
-\TLV
- |default
- @0
- $reset = reset;
- @1
- $lfsr[LFSR_WIDTH-1:0] = $reset ? *SEED : {$lfsr#+1[LFSR_WIDTH-2:0], 1'b0} ^ ({LFSR_WIDTH{$lfsr#+1[LFSR_WIDTH-1]}} & *LFSR_POLY);
- @2
- *rand_vect = $lfsr[WIDTH-1:0];
-
-\SV
-
-endmodule
diff --git a/src/maker/tlv/pseudo_rand.sv b/src/maker/tlv/pseudo_rand.sv
deleted file mode 100755
index a9988b58..00000000
--- a/src/maker/tlv/pseudo_rand.sv
+++ /dev/null
@@ -1,70 +0,0 @@
-`line 2 "pseudo_rand.m4out.tlv" 0 //_\TLV_version 1b: tl-x.org, generated by SandPiper(TM) 1.11-2021/01/28-beta
-`include "sp_default.vh" //_\SV
-/*
-Copyright (c) 2014, Steven F. Hoover
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * The name of Steven F. Hoover
- may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-module pseudo_rand
- #(parameter WIDTH=257) // Random vector width, to a max of 257.
- (input logic clk,
- input logic reset,
- output logic [WIDTH-1:0] rand_vect
- );
-
-// Currently, this implements a Galois LFSR.
-// TODO: It should be XORed with something else so it doesn't just shift.
-// Using polynomials with maximal number of taps would have less regular shifting behavior.
-
-// Bits are numbered in the reverse of the traditional order. This puts the taps in the lower bit positions.
-
-// Choose optimal parameters for given WIDTH.
-localparam LFSR_WIDTH =
- (WIDTH <= 64) ? 64 :
- (WIDTH <= 128) ? 128 :
- (WIDTH <= 257) ? 257 : 0; // 257 enables a large non-power of two for replication on an irregular boundary.
-// Polynomial source: http://www.eej.ulst.ac.uk/~ian/modules/EEE515/files/old_files/lfsr/lfsr_table.pdf
-localparam [LFSR_WIDTH-1:0] LFSR_POLY = {{(LFSR_WIDTH-8){1'b0}},
- (LFSR_WIDTH == 64) ? 8'b00011011 :
- (LFSR_WIDTH == 128) ? 8'b10000111 :
- (LFSR_WIDTH == 257) ? 8'b11000101 : 8'b0};
-
-bit [256:0] SEED = 257'h0_7163e168_713d5431_6684e132_5cd84848_f3048b46_76874654_0c45f864_04e4684a;
-
-
-
-`include "pseudo_rand_gen.sv" //_\TLV
- //_|default
- //_@0
- assign DEFAULT_reset_a0 = reset;
- //_@1
- assign DEFAULT_lfsr_a1[LFSR_WIDTH-1:0] = DEFAULT_reset_a1 ? SEED : {DEFAULT_lfsr_a2[LFSR_WIDTH-2:0], 1'b0} ^ ({LFSR_WIDTH{DEFAULT_lfsr_a2[LFSR_WIDTH-1]}} & LFSR_POLY);
- //_@2
- assign rand_vect = DEFAULT_lfsr_a2[WIDTH-1:0]; endgenerate
-
-//_\SV
-
-endmodule
-
diff --git a/src/maker/tlv/pseudo_rand_gen.sv b/src/maker/tlv/pseudo_rand_gen.sv
deleted file mode 100755
index ec008179..00000000
--- a/src/maker/tlv/pseudo_rand_gen.sv
+++ /dev/null
@@ -1,46 +0,0 @@
-// Generated by SandPiper(TM) 1.11-2021/01/28-beta from Redwood EDA.
-// Redwood EDA does not claim intellectual property rights to this file and provides no warranty regarding its correctness or quality.
-
-
-`include "sandpiper_gen.vh"
-
-
-
-
-
-//
-// Signals declared top-level.
-//
-
-// For |default$lfsr.
-logic [LFSR_WIDTH-1:0] DEFAULT_lfsr_a1,
- DEFAULT_lfsr_a2;
-
-// For |default$reset.
-logic DEFAULT_reset_a0,
- DEFAULT_reset_a1;
-
-
-
-generate
-
-
- //
- // Scope: |default
- //
-
- // For $lfsr.
- always_ff @(posedge clk) DEFAULT_lfsr_a2[LFSR_WIDTH-1:0] <= DEFAULT_lfsr_a1[LFSR_WIDTH-1:0];
-
- // For $reset.
- always_ff @(posedge clk) DEFAULT_reset_a1 <= DEFAULT_reset_a0;
-
-
-
-
-endgenerate
-
-
-
-
-generate // This is awkward, but we need to go into 'generate' context in the line that `includes the declarations file.
diff --git a/src/maker/tlv/sandpiper.vh b/src/maker/tlv/sandpiper.vh
deleted file mode 100755
index ccba8b0e..00000000
--- a/src/maker/tlv/sandpiper.vh
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-Copyright (c) 2015, Steven F. Hoover
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * The name of Steven F. Hoover
- may not be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-// Project-independent SandPiper header file.
-
-`ifndef SANDPIPER_VH
-`define SANDPIPER_VH
-
-
-// Note, these have no SP prefix, so collisions are possible.
-
-
-`ifdef WHEN
- // Make sure user definition does not collide.
- !!!ERROR: WHEN macro already defined
-`else
- `ifdef SP_PHYS
- // Phys compilation disabled X-injection.
- `define WHEN(valid_sig)
- `else
- // Inject X.
- `define WHEN(valid_sig) !valid_sig ? 'x :
- `endif
-`endif
-
-
-// SandPiper does not generate set/reset flops. Reset is implemented as combinational
-// logic, and it is up to synthesis to infer set/reset flops when possible.
-//`ifdef RESET
-// // Make sure user definition does not collide.
-// !!!ERROR: RESET macro already defined
-//`else
-// `define RESET(i, reset) ((reset) ? '0 : i)
-//`endif
-//
-//`ifdef SET
-// // Make sure user definition does not collide.
-// !!!ERROR: SET macro already defined
-//`else
-// `define SET(i, set) ((set) ? '1 : i)
-//`endif
-
-// Since SandPiper required use of all signals, this is useful to create a
-// bogus use and keep SandPiper happy when a signal, by intent, has no uses.
-`define BOGUS_USE(ignore)
-
-`endif // SANDPIPER_VH
-
diff --git a/src/maker/tlv/sandpiper_gen.vh b/src/maker/tlv/sandpiper_gen.vh
deleted file mode 100755
index d063661a..00000000
--- a/src/maker/tlv/sandpiper_gen.vh
+++ /dev/null
@@ -1,4 +0,0 @@
-// This just verifies that sandpiper.vh has been included.
-`ifndef SANDPIPER_VH
- !!!ERROR: SandPiper project's sp_
- Model Created Successfully !
-
+ try:
+ model.verilogfile()
+ error = model.verilogParse()
+ if error != "Error":
+ model.getPortInfo()
+ model.cfuncmod()
+ model.ifspecwrite()
+ model.sim_main_header()
+ model.sim_main()
+ model.modpathlst()
+ model.run_verilator()
+ model.make_verilator()
+ model.copy_verilator()
+ model.runMake()
+
+ if os.name != 'nt':
+ model.runMakeInstall()
+ else:
+ try:
+ shutil.copy(
+ self.release_dir + "/src/xspice/icm/Ngveri/Ngveri.cm",
+ self.nghdl_home + "/lib/ngspice/"
+ )
+ except FileNotFoundError as err:
+ self.entry_var[0].append(
+ "Error in copying Ngveri code model: " + str(err)
+ )
+
+ terminalLog = self.entry_var[0].toPlainText()
+ if "error" not in terminalLog.lower():
+ self.entry_var[0].append('''
+
+ Model Created Successfully!
+
There was an error during model creation,
Please rectify the error and try again !
@@ -256,12 +280,24 @@ class NgVeri(QtWidgets.QWidget):
self.fname = Maker.verilogFile[self.filecount]
model = ModelGeneration.ModelGeneration(
self.fname, self.entry_var[0])
- model.runMake()
- model.runMakeInstall()
- return
- # else:
- # return
+ try:
+ model.runMake()
+
+ if os.name != 'nt':
+ model.runMakeInstall()
+ else:
+ shutil.copy(
+ self.release_dir + "/src/xspice/icm/Ngveri/Ngveri.cm",
+ self.nghdl_home + "/lib/ngspice/"
+ )
+ except BaseException as err:
+ QtWidgets.QMessageBox.critical(
+ None, "Error Message",
+ "The verilog model '" + str(text) +
+ "' could not be removed: " + str(err),
+ QtWidgets.QMessageBox.Ok)
+
# This is to remove lint_off comments needed by the verilator warnings
# This function writes to the lint_off.txt here in the same folder
--
cgit
From 9fcfe12644a7aa88d9f43025eb2065252d4d40e6 Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 01:34:24 +0530
Subject: Check for ToS using defined function
---
src/maker/Maker.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'src/maker')
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index 01095d91..4e71d7fd 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -371,10 +371,10 @@ Please check if Verilog File Chosen.")
self.optionsgrid.addWidget(self.runoptions, 0, 4)
# self.optionsbox.setLayout(self.optionsgrid)
# self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
- if not os.path.isfile(home + "/.makerchip_accepted"):
+ if not makerchipTOSAccepted(False):
self.acceptTOS = QtWidgets.QPushButton("Accept Makerchip TOS")
self.optionsgroupbtn.addButton(self.acceptTOS)
- self.acceptTOS.clicked.connect(self.makerchipaccepted)
+ self.acceptTOS.clicked.connect(lambda: makerchipTOSAccepted(True))
self.optionsgrid.addWidget(self.acceptTOS, 0, 5)
# self.optionsbox.setLayout(self.optionsgrid)
# self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
--
cgit
From b6dcef53727c4a216d7b80d3085c1c0e4651a95a Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 01:38:49 +0530
Subject: Fix crash issue due to recursive file/directory access
---
src/maker/Maker.py | 4 ++++
src/maker/ModelGeneration.py | 19 ++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
(limited to 'src/maker')
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index 4e71d7fd..f3f8b93e 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -125,6 +125,10 @@ class Maker(QtWidgets.QWidget):
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
if reply == QtWidgets.QMessageBox.Ok:
self.addverilog()
+
+ if self.verilogfile == "":
+ return
+
self.obj_Appconfig.print_info('Add Verilog File Called')
elif reply == QtWidgets.QMessageBox.Cancel:
diff --git a/src/maker/ModelGeneration.py b/src/maker/ModelGeneration.py
index a87a04e1..0a6df82c 100755
--- a/src/maker/ModelGeneration.py
+++ b/src/maker/ModelGeneration.py
@@ -1012,23 +1012,32 @@ and set the load for input ports */
init_path = '../../'
if os.name == 'nt':
init_path = ''
+
includefile = QtCore.QDir.toNativeSeparators(
QtWidgets.QFileDialog.getOpenFileName(
self,
"Open adding other necessary files to be included",
init_path + "home")[0])
+
if includefile == "":
reply = QtWidgets.QMessageBox.critical(
None, "Error Message",
"Error: No File Chosen. Please chose a file",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
)
+
if reply == QtWidgets.QMessageBox.Ok:
self.addfile()
+
+ if includefile == "":
+ return
+
self.obj_Appconfig.print_info('Add Other Files Called')
elif reply == QtWidgets.QMessageBox.Cancel:
self.obj_Appconfig.print_info('No File Chosen')
+ return
+
filename = os.path.basename(includefile)
self.modelpath = self.digital_home + \
"/" + self.fname.split('.')[0] + "/"
@@ -1045,9 +1054,9 @@ and set the load for input ports */
print("Added the File:" + filename)
self.termtitle("Added the File:" + filename)
+
# This function is used to add additional folder required by the verilog
# top module
-
def addfolder(self):
# self.cur_dir = os.getcwd()
print("Adding the folder required by the top level module file")
@@ -1055,23 +1064,31 @@ and set the load for input ports */
init_path = '../../'
if os.name == 'nt':
init_path = '' # noqa:F841
+
includefolder = QtCore.QDir.toNativeSeparators(
QtWidgets.QFileDialog.getExistingDirectory(
self, "open", "home"
)
)
+
if includefolder == "":
reply = QtWidgets.QMessageBox.critical(
None, "Error Message",
"Error: No Folder Chosen. Please chose a folder",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
)
+
if reply == QtWidgets.QMessageBox.Ok:
self.addfolder()
+
+ if includefolder == "":
+ return
+
self.obj_Appconfig.print_info('Add Folder Called')
elif reply == QtWidgets.QMessageBox.Cancel:
self.obj_Appconfig.print_info('No File Chosen')
+ return
self.modelpath = self.digital_home + \
"/" + self.fname.split('.')[0] + "/"
--
cgit
From 2b0b878d72c74e3a335b346362eaa533c5459821 Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 01:39:49 +0530
Subject: Fix empty line lint_off crash issues
---
src/maker/ModelGeneration.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'src/maker')
diff --git a/src/maker/ModelGeneration.py b/src/maker/ModelGeneration.py
index 0a6df82c..cbb268af 100755
--- a/src/maker/ModelGeneration.py
+++ b/src/maker/ModelGeneration.py
@@ -806,10 +806,12 @@ and set the load for input ports */
init_path = ''
self.cur_dir = os.getcwd()
- file = open(init_path + "library/tlv/lint_off.txt").readlines()
wno = " "
- for item in file:
- wno += " -Wno-" + item.strip("\n")
+ with open(init_path + "library/tlv/lint_off.txt") as file:
+ for item in file.readlines():
+ if item and item.strip():
+ wno += " -Wno-" + item.strip("\n")
+
print("Running Verilator.............")
os.chdir(self.modelpath)
self.release_home = self.parser.get('NGHDL', 'RELEASE')
--
cgit
From ab7dd7ed89899e2a17f70262e83437f50f2a924f Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 01:42:24 +0530
Subject: Fixed saving empty file crash issue
---
src/maker/Maker.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
(limited to 'src/maker')
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index f3f8b93e..6d97e4d3 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -194,8 +194,18 @@ class Maker(QtWidgets.QWidget):
# This function is used to save the edited file in eSim
def save(self):
- wr = self.entry_var[1].toPlainText()
- open(self.verilogfile, "w+").write(wr)
+ try:
+ wr = self.entry_var[1].toPlainText()
+ open(self.verilogfile, "w+").write(wr)
+ except BaseException as err:
+ self.msg = QtWidgets.QErrorMessage(self)
+ self.msg.setModal(True)
+ self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ "Error in saving verilog file. Please check if it is chosen."
+ )
+ self.msg.exec_()
+ print("Error in saving verilog file: " + str(err))
# This is used to run the makerchip-app
def runmakerchip(self):
--
cgit
From 272bf20219595c3c541797b1045ce9c400ab02d6 Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 01:50:56 +0530
Subject: Added a note and tooltip for Makerchip requirements
---
src/maker/Maker.py | 21 +++++++++++++--------
src/maker/NgVeri.py | 4 ++++
2 files changed, 17 insertions(+), 8 deletions(-)
(limited to 'src/maker')
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index 6d97e4d3..9f4263c2 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -224,14 +224,15 @@ class Maker(QtWidgets.QWidget):
if self.verilogfile.split('.')[-1] != "tlv":
reply = QtWidgets.QMessageBox.warning(
None,
- "Do you want to automate top module?",
- "Click on YES if you want top module \
- to be automatically added. \
- NOTE: a .tlv file will be created \
- in the directory of current verilog file\
- and the makerchip will be running on \
- this file. Otherwise click on NO.
\
- To not open Makerchip, click CANCEL",
+ "Do you want to automate the top module? ",
+ "Click on YES button if you want the top module \
+ to be added automatically. A .tlv file will be created \
+ in the directory of current verilog file \
+ and the Makerchip IDE will be running on \
+ this file. Otherwise click on NO button. \
+ To not open Makerchip IDE, click on CANCEL button. \
+
NOTE: Makerchip IDE requires an active \
+ internet connection and a browser.",
QtWidgets.QMessageBox.Yes
| QtWidgets.QMessageBox.No
| QtWidgets.QMessageBox.Cancel)
@@ -380,6 +381,10 @@ Please check if Verilog File Chosen.")
# self.optionsbox.setLayout(self.optionsgrid)
# self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.runoptions = QtWidgets.QPushButton("Edit in Makerchip")
+ self.runoptions.setToolTip(
+ "Requires internet connection and a browser"
+ )
+ self.runoptions.setToolTipDuration(5000)
self.optionsgroupbtn.addButton(self.runoptions)
self.runoptions.clicked.connect(self.runmakerchip)
self.optionsgrid.addWidget(self.runoptions, 0, 4)
diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py
index c3c4d07c..c1fbcb4e 100755
--- a/src/maker/NgVeri.py
+++ b/src/maker/NgVeri.py
@@ -226,6 +226,10 @@ class NgVeri(QtWidgets.QWidget):
self.addverilogbutton = QtWidgets.QPushButton(
"Run Verilog to NgSpice Converter")
+ self.addverilogbutton.setToolTip(
+ "Requires internet connection for converting TL-Verilog models"
+ )
+ self.addverilogbutton.setToolTipDuration(5000)
self.optionsgroupbtn.addButton(self.addverilogbutton)
self.addverilogbutton.clicked.connect(self.addverilog)
self.optionsgrid.addWidget(self.addverilogbutton, 0, 1)
--
cgit
From 87bc2c82192c948ddb88c52dfcd5213920920c2f Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 02:31:30 +0530
Subject: Fixed typos and resolved flake8 issues
---
src/maker/Maker.py | 44 +++++++++++-------------
src/maker/ModelGeneration.py | 55 ++++++++++++++----------------
src/maker/NgVeri.py | 81 ++++++++++++++++++++++----------------------
src/maker/createkicad.py | 15 ++++----
src/maker/makerchip.py | 10 +-----
5 files changed, 95 insertions(+), 110 deletions(-)
mode change 100755 => 100644 src/maker/createkicad.py
(limited to 'src/maker')
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index 9f4263c2..c7a66204 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -27,17 +27,11 @@
# =========================================================================
# importing the files and libraries
-from xml.etree import ElementTree as ET # noqa:F401
import hdlparse.verilog_parser as vlog
-import time # noqa:F401
from PyQt5 import QtCore, QtWidgets
-from PyQt5.QtCore import QThread, Qt # noqa:F401
-from PyQt5.QtWidgets \
- import QApplication, \
- QWidget, QLabel, QVBoxLayout # noqa:F401
+from PyQt5.QtCore import QThread
from configuration.Appconfig import Appconfig
import os
-import subprocess # noqa:F401
import watchdog.events
import watchdog.observers
from os.path import expanduser
@@ -101,7 +95,7 @@ class Maker(QtWidgets.QWidget):
# self.grid.addWidget(self.creategroup(), 1, 0, 5, 0)
self.show()
- # This function is to Add new verilog file
+ # This function is to Add new verilog file
def addverilog(self):
init_path = '../../'
@@ -109,7 +103,7 @@ class Maker(QtWidgets.QWidget):
init_path = ''
self.verilogfile = QtCore.QDir.toNativeSeparators(
QtWidgets.QFileDialog.getOpenFileName(
- self, "Open verilog Directory",
+ self, "Open Verilog Directory",
init_path + "home", "*v"
)[0]
)
@@ -120,9 +114,10 @@ class Maker(QtWidgets.QWidget):
reply = QtWidgets.QMessageBox.critical(
None,
"Error Message",
- "Error: No Verilog File Chosen.\
- Please chose a Verilog file",
+ "No Verilog File Chosen. \
+ Please choose a verilog file.",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
+
if reply == QtWidgets.QMessageBox.Ok:
self.addverilog()
@@ -211,12 +206,12 @@ class Maker(QtWidgets.QWidget):
def runmakerchip(self):
init_path = '../../'
if os.name == 'nt':
- init_path = '' # noqa:F841
+ init_path = ''
try:
if not makerchipTOSAccepted(True):
return
- print("Running Makerchip..............................")
+ print("Running Makerchip IDE...........................")
# self.file = open(self.verilogfile,"w")
# self.file.write(self.entry_var[1].toPlainText())
# self.file.close()
@@ -246,13 +241,13 @@ class Maker(QtWidgets.QWidget):
file = os.path.basename('.'.join(
self.verilogfile.split('.')[:-1]))
f = open(filename, 'w')
- flag = 1 # noqa F841
- ports = "" # noqa F841
code = code.replace(" wire ", " ")
code = code.replace(" reg ", " ")
vlog_ex = vlog.VerilogExtractor()
vlog_mods = vlog_ex.extract_objects_from_source(code)
- lint_off = open(init_path + "library/tlv/lint_off.txt").readlines()
+ lint_off = open(
+ init_path + "library/tlv/lint_off.txt"
+ ).readlines()
string = '''\\TLV_version 1d: tl-x.org\n\\SV\n'''
for item in lint_off:
string += "/* verilator lint_off " + \
@@ -281,11 +276,11 @@ output logic passed, output logic failed);\n'''
"Error Message",
"Error: File name and module \
name are not same. Please \
- ensure that they are same",
+ ensure that they are same.
- Model Created Successfully! +
Model Created Successfully!
''') @@ -156,35 +155,37 @@ class NgVeri(QtWidgets.QWidget): except BaseException as err: self.entry_var[0].append( - "Error in Ngspice code model generation from Verilog: " + str(err) + "Error in Ngspice code model generation " + + "from Verilog: " + str(err) ) terminalLog = self.entry_var[0].toPlainText() if "error" in terminalLog.lower(): self.entry_var[0].append(''' -
- There was an error during model creation,
-
- Please rectify the error and try again !
+
There was an error during model creation,
+
Please rectify the error and try again!