Skip to content

Commit

Permalink
Update hydra_93xx.py (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainpelissier authored and Baldanos committed Dec 17, 2019
1 parent abad2b2 commit 0f29df1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions contrib/pyHydra_93xx/hydra_93xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, port="", address_size=8, word_size=16):
"""
Handler constructor
:param address_size: Address size in bits
:type data: int
:type address_size: int
:param word_size: Word size in bits
:type word_size: int
"""
Expand Down Expand Up @@ -68,9 +68,9 @@ def read_data(self, address, num):
Read: opcode 10
:param address: Address to read
:type data: int
:type address: int
:param num: number of words to read
:type word_size: int
:type num: int
"""
data_format = "{:0" + str(self.address_size) + "b}"
addr_bin = data_format.format(address)
Expand Down Expand Up @@ -98,12 +98,12 @@ def write_data(self, address, data):
Read: opcode 01
:param address: Address to write
:type data: int
:type address: int
:param data: data to write
:type word_size: bytes
:type data: bytes
"""

if len(data)*8 % self.word_size != 0:
if len(data) % self.word_size != 0:
print("Data length must be multiple of %d bits" % self.word_size * 8)
exit(2)

Expand Down

0 comments on commit 0f29df1

Please sign in to comment.