Commit eb6ffffc authored by Andrey Filippov's avatar Andrey Filippov
Browse files

More changes when working with cocotb

parent e3c85766
Loading
Loading
Loading
Loading
+33 −3
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ RAISED_EXCEPTION="raised exception:"
COMMA_LINE=", line"
state = None # None - pass, cocotb - collecting Cocotb problem, python- just raw python problem
lines = []
PATTERN_PS =        re.compile(r"(\d+\.\d+) ps")
PATTERN_FILE_LINE = re.compile('([\w/-]*\.[v|V][hH]?):\s*([0-9]+)')
TRUNCATE_PATH =     True
NS_FORMAT =         "%10.3fns"
def report_python(lines):
    err_msg=lines[0]
    for i in range((len(lines)-1)//2):
@@ -59,6 +63,34 @@ def report_python(lines):

for line in iter(sys.stdin.readline,''):
    sline = line.strip()
    #Replace picoseconds with nanoseconds
    ps=PATTERN_PS.match(sline)
    while ps:
        try:
            ns=NS_FORMAT%(0.001*float(ps.group(1)))
        except:
            break
        sline = sline[:ps.start(0)]+ns+sline[ps.end(0):]
        ps = PATTERN_PS.match(sline)
    #Recognize verilog file:line and get rid of spaces between them
    
    fl=PATTERN_FILE_LINE.search(sline)
    if fl:
        if fl.start(0)!=0: #Icarus compiler output, keep as is (controlled by warnings/errors/sorry
            
            #lsof -i TCP| fgrep LISTEN
            fname=fl.group(1)
            if TRUNCATE_PATH:
                try:
                    lastSlashIndex=fname.rindex('/')
                    fname=fname[lastSlashIndex+1:]
                except:
                    pass
            subl="SIM: %20s:%4d in simulator "%(fname,int(fl.group(2)))
            sline = sline[:fl.start(0)]+subl+sline[fl.end(0):]
            
            
            
    if state == "cocotb":
        if (len(lines)%2 == 0) or sline.startswith('File "'):
            lines.append(sline)
@@ -87,11 +119,9 @@ for line in iter(sys.stdin.readline,''):
            lines =[sline]
            sys.stdout.write(line)
            
            
            
            continue
        else:
            sys.stdout.write(line)    
            sys.stdout.write(sline+"\n")    
            
    
        
+23 −6
Original line number Diff line number Diff line
@@ -265,6 +265,9 @@
		<parameter id="ShowInfo" type="BoolYesNo" format="None"
			default="true" label="Show info messages" />

		<parameter id="ShowSim" type="BoolYesNo" format="None"
			default="true" label="Show Simulator" tooltip="Show simulator output with filename/line" />

		<parameter id="FilterParser" type="BoolYesNo" format="None"
			default="true" label="Filter simulation output with an external parser" />

@@ -316,7 +319,7 @@
        			default="(.*):([0-9]+): [a-z_\- ]*[warning|sorry]: (.*)"
        			visible="true"  type="String" format="CopyValue"/>
        <parameter	id="PatternInfo"   label="Info" tooltip= "Regular expression for info messages"
        			default=".*[\s.](\w*\.py):([0-9]+)\s*\S*\s*\S*\s*(.*)"
        			default=".*[\s.]([\w-]*\.py|[\w/-]*\.[v|V][hH]?):\s*([0-9]+)\s*\S*\s*\S*\s*(.*)"
        			visible="true"  type="String" format="CopyValue"/>

			
@@ -388,6 +391,15 @@
			 format="CopyValue" default="" visible="true" />
		</if-not>
			 
		<if ShowSim="true">
		     <parameter id="GrepSim" type="String" label = "GrepSim"
			 format="CopyValue" default="|SIM:" visible="true" />
		</if>	 
		<if-not ShowSim="true">
		     <parameter id="GrepSim" type="String" label = "GrepSim"
			 format="CopyValue" default="" visible="true" />
		</if-not>	 

		<if ShowInfo="true">
		     <parameter id="GrepInfo" type="String" label = "GrepInfo"
			 format="CopyValue" default="|info|INFO" visible="true" />
@@ -408,8 +420,10 @@


        <parameter id="GrepEWI" type="String" label = "GrepWarning"
		format="GrepFindSyntax" default="error|ERROR%GrepWarning%GrepInfo%GrepDebug" visible="true" readonly="true"/>
		format="GrepFindSyntax" default="error|ERROR%GrepWarning%GrepInfo%GrepDebug%GrepSim" visible="true" readonly="true"/>

	    <parameter id="SIMULATION_PATH" type="String"
			 format="MakefileExport" default= "%%ProjectPath/%SimulDir" visible="false" />


		<input>
@@ -446,6 +460,7 @@
				"ShowNoProblem"
				"ShowWarnings"
				"ShowInfo"
				"ShowSim"
				"RemoveBugs"
				"SaveLogsPreprocessor"
				"SaveLogsSimulator"
@@ -508,8 +523,10 @@
			 errors=   "PatternErrors"
			 warnings= "PatternWarnings"
			 info=     "PatternInfo"
			 failure = "ERROR|CRITICAL"
			 failure = "CRITICAL"
	         >
<!-- 			 failure = "ERROR|CRITICAL"
 -->
 				"%Param_Shell_Options"
				"%Param_PreExe"
<!--  MKDIR - ALWAYS -->				
@@ -528,7 +545,7 @@
						"%%ProjectPath/%LogFileFull"
					</if>
					<if FilterParser="true">
					    "|python -u %parsers_path/%parser_name"
					    "|python -u %parsers_path%parser_name"
					</if>					
 				    <if ShowNoProblem="false">
 				        "%GrepEWI"
@@ -580,7 +597,7 @@
				"%CocotbRANDOM_SEED"
				"%COCOTB_DEBUG"
				"%COCOTB_ANSI_OUTPUT"

				"%SIMULATION_PATH"
				"%CocotbVERILOG_SOURCES"
				"%CocotbExtraFiles"				
				"%CocotbVHDL_SOURCES"