soc/cores/identifier: append 0 to contents to indicate end of string

This commit is contained in:
Florent Kermarrec 2017-06-22 17:53:19 +02:00
parent bdc61106d1
commit 1364ac3657
1 changed files with 2 additions and 1 deletions

View File

@ -5,8 +5,9 @@ class Identifier(Module):
def __init__(self, ident): def __init__(self, ident):
contents = list(ident.encode()) contents = list(ident.encode())
l = len(contents) l = len(contents)
if l > 256: if l > 255:
raise ValueError("Identifier string must be 255 characters or less") raise ValueError("Identifier string must be 255 characters or less")
contents.append(0)
self.mem = Memory(8, len(contents), init=contents) self.mem = Memory(8, len(contents), init=contents)
def get_memories(self): def get_memories(self):