Commit 93f6ec5d authored by Debjit Pal's avatar Debjit Pal
Browse files

Adding codes that was not committed before

parent d3bc811c
[Configuration]
Protocols: ['pio_write', 'pio_read', 'upstream_ncu', 'downstream_ncu']
Protocols: ['mondo', 'upstream_ncu', 'downstream_ncu']
Message_width: {'approach': 1, 'lower': 1, 'enter': 1, 'exit': 1, 'rais': 1, 'pioreq': 50, 'piowcrd': 5, 'dmusiidata': 20, 'reqtot': 1, 'grant': 1, 'siincu': 12, 'mondoacknack': 8, 'niusiidata': 130, 'siil2t': 32, 'l2tmcu': 41, 'mcul2tack': 1, 'mcul2tdata': 134, 'l2bsio': 34, 'siodmu': 130, 'cpxncugnt':8, 'RxInfo':11, 'PIDToken':16, 'RxDataStat':2, 'RxDataEnd':1, 'RxDmaEn':35, 'DmaDone':1, 'ReplyAck':5, 'ValidTx':11, 'TxDmaEn': 18, 'DataSend':10, 'ReqE':1, 'GntE':1, 'Ack':1, 'pcx2ncuload':131, 'ncu2mcuload':5, 'mcu2ncucpxload':129, 'ncu2cpxreqdata':154}
Buffer_width: 32
Message_group: {'pioreq': {'pioheader':1, 'pioreadwrite':1, 'ncucredid':4, 'ncuid':8, 'busaddr':36}, 'dmusiidata':{'dmuheader':1, 'dmurwm':2, 'dmudestqueue':1, 'ncucredid':4, 'cputhreadid':6}, 'siincu':{'ncucredid':4, 'ncuid':8}, 'piowcrd':{'ncucredid':4, 'ncucredvld':1}, 'mondoacknack':{'ack':1, 'nack':1, 'mondoid':6}, 'RxInfo':{'rxdata':8, 'rxvalid':1, 'rxactive':1, 'rxerr':1}, 'PIDToken':{'pid_OUT':1, 'pid_IN':1, 'pid_SOF':1, 'pid_SETUP':1, 'pid_DATA0':1, 'pid_DATA1':1, 'pid_DATA2':1, 'pid_MDATA':1, 'pid_ACK':1, 'pid_NACK':1, 'pid_STALL':1, 'pid_NYET':1, 'pid_PRE':1, 'pid_ERR':1, 'pid_SPLIT':1, 'pid_PING':1}, 'RxDataStat':{'rxdatavalid':1, 'tokenvalid':1}, 'RxDmaEn':{'rxdmaen':1, 'abort':1, 'dmaen':1, 'sendzerolength':1, 'bufsize':14, 'adr':17}, 'ValidTx':{'txdata':8, 'txvalid':1, 'txvalidlast':1, 'txfirst':1}, 'ReplyAck':{'sendtoken':1, 'tokenpidsel':2, 'dmapidsel':2}, 'TxDmaEn':{'txdmaen':1, 'adr':17}, 'DataSend':{'senddata':1, 'txdatast':8, 'rdnext':1}, 'pcx2ncuload':{'initdatatxfr':1, 'datatxfr':130}, 'ncu2mcuload':{'readreqpcx':1, 'datapacket':4}, 'mcu2ncucpxload':{'readackcpxncuload':1, 'datapacket':4}, 'ncu2cpxreqdata':{'ncucpxreq':8, 'ncucpxdata':146}}
......@@ -29,7 +29,7 @@ protocolatom: []
protocol: {('prd_init',): {'pioreq': [('prd_gpio_rd_data',)]}, ('prd_gpio_rd_data',): {'dmusiidata': [('prd_req',)]}, ('prd_req',): {'reqtot': [('prd_gntreq',)]}, ('prd_gntreq',): {'grant': [('prd_ret_rdpkt',)]}, ('prd_ret_rdpkt',): {'siincu': [('prd_rdpkt_rcvd',)]}}
[mondo]
noofinstances: 2
noofinstances: 1
protocolnodes: [('mn_init',), ('mn_req',), ('mn_gntreq',), ('mn_snd_payl',), ('mn_proc_int',), ('mn_int_processed',)]
protocolatom: []
protocol: {('mn_init',): {'dmusiidata': [('mn_req',)]}, ('mn_req',): {'reqtot': [('mn_gntreq',)]}, ('mn_gntreq',): {'grant': [('mn_snd_payl',)]}, ('mn_snd_payl',): {'siincu': [('mn_proc_int',)]}, ('mn_proc_int',): {'mondoacknack': [('mn_int_processed',)]}}
......@@ -64,6 +64,6 @@ protocol: {('ReceivingData_1',): {'RxInfo': [('DecodePacket_1',)]}, ('DecodePack
[cache_coherence]
noofinstances: 2
protocolnodes: [('Noncrit',), ('Wait',), ('Crit',), ('Done',)]
protocolatom: [('Crit',)]
protocol: {('Noncrit',): {'ReqE': [('Wait',)]}, ('Wait',): {'GntE': [('Crit',)]}, ('Crit',): {'Ack': [('Done',)]}}
protocolnodes: [('Init',), ('Wait',), ('GgntWr',), ('Done',)]
protocolatom: [('GgntWr',)]
protocol: {('Init',): {'ReqE': [('Wait',)]}, ('Wait',): {'GntE': [('GgntWr',)]}, ('GgntWr',): {'Ack': [('Done',)]}}
......@@ -318,7 +318,7 @@ def GetAllPossibleCandidates(unique_message, listmsg, message_width, buffer_widt
candidates.append(i)
msg_width_sum = 0
'''
for j in range(2, len(unique_message) + 1):
for j in range(1, len(unique_message) + 1):
for i in itertools.combinations(unique_message, j):
#print i
candidates_ = []
......@@ -342,10 +342,12 @@ def EvalMsgGroups(message_width, candidates, sysnodes, listmsg, countlistmsg, x,
'''
max_info = {}
max_candidate = {}
max_candidate_cov = {}
info_candidates = {}
totaledges = 0
for ele in range(len(countlistmsg)):
totaledges = totaledges + countlistmsg[ele]
print "Total edges: ", totaledges
for c in candidates:
#print c
if len(c) not in max_info:
......@@ -369,12 +371,21 @@ def EvalMsgGroups(message_width, candidates, sysnodes, listmsg, countlistmsg, x,
#print "x: ", x
info_candidates[c] = mut_info(x, y, xy)
print "Candidate: ", c, " Info Gain: ", info_candidates[c]
#print info_candidates[c]
#print "info_candidate:", info_candidates[c], "\n"
if (info_candidates[c] > max_info[len(c)]):
max_info[len(c)] = info_candidates[c]
max_candidate[len(c)] = c
totalState = 0
for state in x_y:
for msg in c:
if state[listmsg.index(msg)] != 0:
totalState = totalState + 1
break
max_candidate_cov[len(c)] = float(totalState)/float(len(sysnodes))
MaxEle = max(max_candidate.keys())
#print "MaxEle: ", MaxEle
Infocurr = max_info[MaxEle]
......@@ -389,6 +400,11 @@ def EvalMsgGroups(message_width, candidates, sysnodes, listmsg, countlistmsg, x,
TotalBits = TotalBits + Mtrace[msg_]
MsgConsidered.append(msg_)
print "\n\n"
print max_info
print "\n\n"
print max_candidate_cov
print "\n\n"
return Mtrace, TotalBits, Infocurr
......
......@@ -229,23 +229,23 @@ nx.draw_networkx_edge_labels(G, pos, labels = edge_labels)
plt.savefig('lts.png')
plt.show()
'''
#graph = pd.Dot(graph_type = 'digraph')
### Add all nodes in the graph
#NodeDict = {}
#nodeNumber = 0
#node_file_name = open('node_mapping.txt', 'w')
#for i in sysnodes:
# nodeNumber = nodeNumber + 1
# NodeDict[i] = pd.Node(str(nodeNumber), style="filled", fillcolor="blue")
# graph.add_node(NodeDict[i])
# node_file_name.write(str(i) + " : " + str(nodeNumber) + "\n")
#
#node_file_name.close()
#
#for i in sysnodes:
# for j in sys[i]:
# for k in sys[i][j]:
# graph.add_edge(pd.Edge(NodeDict[i], NodeDict[k], label=j))
#
#graph.write_pdf("./pdf/lts.pdf")
#graph.write_png("lts.png")
graph = pd.Dot(graph_type = 'digraph')
## Add all nodes in the graph
NodeDict = {}
nodeNumber = 0
node_file_name = open('node_mapping.txt', 'w')
for i in sysnodes:
nodeNumber = nodeNumber + 1
NodeDict[i] = pd.Node(str(nodeNumber), style="filled", fillcolor="blue")
graph.add_node(NodeDict[i])
node_file_name.write(str(i) + " : " + str(nodeNumber) + "\n")
node_file_name.close()
for i in sysnodes:
for j in sys[i]:
for k in sys[i][j]:
graph.add_edge(pd.Edge(NodeDict[i], NodeDict[k], label=j))
graph.write_pdf("./pdf/lts.pdf")
graph.write_png("lts.png")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment