Line 32... |
Line 32... |
${packages}
|
${packages}
|
|
|
package ${package_name} is
|
package ${package_name} is
|
|
|
function ${function_name} (
|
function ${function_name} (
|
constant desc : in string;
|
constant leq_id : in string;
|
constant n : in integer)
|
constant n : in integer)
|
return integer;
|
return integer;
|
|
|
|
|
end package ${package_name};
|
end package ${package_name};
|
|
|
package body ${package_name} is
|
package body ${package_name} is
|
|
|
function ${function_name} (
|
function ${function_name} (
|
constant desc : in string;
|
constant leq_id : in string;
|
constant n : in integer)
|
constant n : in integer)
|
return integer is
|
return integer is
|
begin -- function ${function_name}
|
begin -- function ${function_name}
|
if desc = "" then
|
if leq_id = "" then
|
return 0;
|
return 0;
|
${generated_clauses}
|
${generated_clauses}
|
else
|
else
|
return 0;
|
return 0;
|
end if;
|
end if;
|
Line 107... |
Line 107... |
# If it is the first run, the file may not exist yet
|
# If it is the first run, the file may not exist yet
|
# In this case we generate function which always returns
|
# In this case we generate function which always returns
|
# delay=0
|
# delay=0
|
try:
|
try:
|
with open(report_file,"r") as fin:
|
with open(report_file,"r") as fin:
|
# The delay report contains lines containing the desc, the input number and the delay value.
|
# The delay report contains lines containing the leq_id, the input number and the delay value.
|
# Each series of values is finished with line containing the desc and the "end" string.
|
# Each series of values is finished with line containing the leq_id and the "end" string.
|
# We read lines from the file. For each new identifier found we create an object which
|
# We read lines from the file. For each new identifier found we create an object which
|
# will accumulate delay data for that identifier.
|
# will accumulate delay data for that identifier.
|
# Then we will feed that object with lines. After the line with "end" is received, we calculate
|
# Then we will feed that object with lines. After the line with "end" is received, we calculate
|
# the delay difference. IT SHOULD NOT CHANGE DURING THE SIMULATION
|
# the delay difference. IT SHOULD NOT CHANGE DURING THE SIMULATION
|
ids = {}
|
ids = {}
|
for line in fin:
|
for line in fin:
|
t=line.strip().split(",")
|
t=line.strip().split(",")
|
if len(t) < 2:
|
if len(t) < 2:
|
break
|
break
|
#desc is in t[0]
|
#leq_id is in t[0]
|
if not t[0] in ids:
|
if not t[0] in ids:
|
#add the object
|
#add the object
|
ids[t[0]] = del_checker()
|
ids[t[0]] = del_checker()
|
#Feed the analyser with the received line
|
#Feed the analyser with the received line
|
ids[t[0]].feed(t)
|
ids[t[0]].feed(t)
|
Line 131... |
Line 131... |
return("")
|
return("")
|
#All lines read, now generate the results
|
#All lines read, now generate the results
|
#Iterate over all identifiers
|
#Iterate over all identifiers
|
res=""
|
res=""
|
for ni in ids.keys():
|
for ni in ids.keys():
|
res += " elsif desc=\""+ni+"\" then\n"
|
res += " elsif leq_id=\""+ni+"\" then\n"
|
res += " case n is\n"
|
res += " case n is\n"
|
for k,v in ids[ni].dels.items():
|
for k,v in ids[ni].dels.items():
|
res += " when "+str(k)+" => return "+str(v)+";\n"
|
res += " when "+str(k)+" => return "+str(v)+";\n"
|
res += " when others => return -1;\n"
|
res += " when others => return -1;\n"
|
res += " end case;\n"
|
res += " end case;\n"
|