forked from Poojan987/Competitive-Programming-CP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtp.py
36 lines (30 loc) · 711 Bytes
/
tp.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
33
34
35
36
print(pow(2, 15))
imm = 0
ALUOUT = 0
updatePC = False
# There are 5 dummy instructions
# each instruction is of 25 bits
instructionList = ['10110', '10010', '01101', '00011', '01111']
pc = 0
updatePC = 0
newAddress = 0
# Here is the fetch function
def fetch():
# Taking current address in temp variable
address = pc
# If there is jump the address will jump
if(updatePC):
address = newAddress
# Else there will be increment in the pc
else:
address += 1
return address
while(True):
cur_instruction = instructionList[pc]
# 5 cycle stages
for i in range(5):
if(i >= 1):
continue
else:
# Fetch
fetch()