mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 19:58:25 +08:00
soc: optimize programmable identifier
This commit is contained in:
parent
9e66dd7075
commit
4a8d361ace
@ -34,21 +34,14 @@ class ReprogrammableIdentifier(Module, AutoCSR):
|
|||||||
raise ValueError("Identifier string must be 255 characters or less")
|
raise ValueError("Identifier string must be 255 characters or less")
|
||||||
contents.insert(0, l)
|
contents.insert(0, l)
|
||||||
|
|
||||||
init_params = {i: 0 for i in range(0x40)}
|
for i in range(8):
|
||||||
for i, c in enumerate(contents):
|
self.specials += Instance("ROM256X1", name="identifier_str"+str(i),
|
||||||
# 0x38 was determined empirically. Another Xilinx mystery.
|
i_A0=self.address.storage[0], i_A1=self.address.storage[1],
|
||||||
row = 0x38 + i//32
|
i_A2=self.address.storage[2], i_A3=self.address.storage[3],
|
||||||
col = 8*(i % 32)
|
i_A4=self.address.storage[4], i_A5=self.address.storage[5],
|
||||||
init_params[row] |= c << col
|
i_A6=self.address.storage[6], i_A7=self.address.storage[7],
|
||||||
init_params = {"p_INIT_{:02X}".format(k): v for k, v in init_params.items()}
|
o_O=self.data.status[i],
|
||||||
|
p_INIT=sum(1 << j if c & (1 << i) else 0 for j, c in enumerate(contents)))
|
||||||
self.specials += Instance("RAMB18E1", name="identifier_str",
|
|
||||||
i_ADDRARDADDR=Cat(C(0, 3), self.address.storage),
|
|
||||||
i_CLKARDCLK=ClockSignal(),
|
|
||||||
o_DOADO=self.data.status,
|
|
||||||
i_ENARDEN=1,
|
|
||||||
p_READ_WIDTH_A=9,
|
|
||||||
**init_params)
|
|
||||||
|
|
||||||
|
|
||||||
def add_identifier(soc, *args, **kwargs):
|
def add_identifier(soc, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user