-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_the_instruction.py
32 lines (25 loc) · 1.12 KB
/
print_the_instruction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def print_the_instruction(Parameter,List,cycle_count):
file1=open("instruction_data.txt",'a')
if Parameter ==1:
file1.write('Fetch has been done in cycle number ' + str(cycle_count)+'\n')
file1.write(str(List)+'\n')
elif Parameter==2:
file1.write('Decode has been done in cycle number ' + str(cycle_count)+'\n')
file1.write(str(List)+'\n')
elif Parameter==3:
file1.write('Execute has been done in cycle number ' + str(cycle_count) + '\n')
file1.write(str(List)+'\n')
elif Parameter==4:
file1.write(' Memory access has been done in cycle number ' + str(cycle_count)+'\n')
file1.write(str(List)+'\n')
elif Parameter==5:
file1.write('Memory access has been done in cycle number ' + str(cycle_count)+'\n')
file1.write('Instruction has been completely executed and moved out of pipeline'+'\n')
file1.close()
return
def print_the_buffer(pipeline):
for x in pipeline:
print(x)
def print_the_registerfile(register):
print(register)
return