summaryrefslogtreecommitdiff
path: root/src/projManagement/Validation.py
diff options
context:
space:
mode:
authorTanay Mathur2015-06-23 11:50:52 +0530
committerTanay Mathur2015-06-23 11:50:52 +0530
commit39fecda9f1be8b1007552437d53c06bdc02f4b47 (patch)
tree3f4bffd09e28240509a215a4b00b3f8b4dda712a /src/projManagement/Validation.py
parentf47a744451fe634efb487023f073321ceed4664c (diff)
downloadeSim-39fecda9f1be8b1007552437d53c06bdc02f4b47.tar.gz
eSim-39fecda9f1be8b1007552437d53c06bdc02f4b47.tar.bz2
eSim-39fecda9f1be8b1007552437d53c06bdc02f4b47.zip
Added subcircuit functionality
Diffstat (limited to 'src/projManagement/Validation.py')
-rw-r--r--src/projManagement/Validation.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
index a3d84979..ac0473af 100644
--- a/src/projManagement/Validation.py
+++ b/src/projManagement/Validation.py
@@ -83,7 +83,31 @@ class Validation:
else:
return False
-
-
-
- \ No newline at end of file
+ def validateSub(self,subDir,givenNum):
+ """
+ This function checks if ".sub" file is present.
+ """
+ subName = os.path.basename(str(subDir))
+ lookSub = os.path.join(str(subDir),subName+".sub")
+ #Check existence of project
+ if os.path.exists(lookSub):
+ f = open(lookSub)
+ data=f.read()
+ f.close()
+ netlist=data.splitlines()
+ for eachline in netlist:
+ eachline=eachline.strip()
+ if len(eachline)<1:
+ continue
+ words=eachline.split()
+ if words[0] == '.subckt':
+ #The number of ports is specified in this line
+ #eg. '.subckt ua741 6 7 3' has 3 ports (6, 7 and 3).
+ numPorts = len(words) - 2
+ print "Looksub",lookSub,givenNum,numPorts
+ if numPorts != givenNum:
+ return "PORT"
+ else:
+ return "True"
+ else:
+ return "DIREC" \ No newline at end of file