Skip to content

Commit

Permalink
Use str.zfill method to pad binary strings
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Jan 11, 2016
1 parent 2fcc479 commit 4562def
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_bin_addr(word_addr, num_addr_bits=None):
return bin_addr
else:
# Pad binary address with zeroes if too short
bin_addr = ('0' * (num_addr_bits - len(bin_addr))) + bin_addr
bin_addr = bin_addr.zfill(num_addr_bits)
return bin_addr


Expand Down

0 comments on commit 4562def

Please sign in to comment.