Input test (U28, U15) helper logic

master
kaqu 2 years ago
parent 9546d06dd8
commit b8ba9107d9
  1. 81
      neopixelar.py

@ -16,6 +16,8 @@
# 14.09.20/KQ Initial version, some output ports activated (user_led, J4) for testing
# 15.09.20/KQ Own logic exported to external module (neopixelprotocol.py - now neopixelengine.py)
# 19.09.20/KQ Project renamed 'NeoPixelar' (swedish plural for NeoPixel ...)
# 20.11.20/KQ Input provided: U28 -> J1 (1, 2, 3, [4=GND], 5, 6, 7), J2 (1, 2, [4=GND])
# U15 -> J7 ([4=GND], 5, 7), J8 (1, 2, 3, [4=GND], 5, 6, 7)
#
# Build/Use ----------------------------------------------------------------------------------------
# - 'python3 neopixelar.py --build --revision=7.0 --uart-name=crossover --with-etherbone --ip-address=192.168.1.20 --csr-csv=build/csr.csv'
@ -84,13 +86,13 @@ _gpios = [
# Attn. Jx/pin descriptions are 1-based, but zero based defs. used!
# J1
("gpio", 0, Pins("j1:0"), IOStandard("LVCMOS33")),
("gpio", 1, Pins("j1:1"), IOStandard("LVCMOS33")),
("gpio", 2, Pins("j1:2"), IOStandard("LVCMOS33")),
("gpio", 0, Pins("j1:0"), IOStandard("LVCMOS33")), # Input now
("gpio", 1, Pins("j1:1"), IOStandard("LVCMOS33")), # Input now
("gpio", 2, Pins("j1:2"), IOStandard("LVCMOS33")), # Input now
# GND
("gpio", 3, Pins("j1:4"), IOStandard("LVCMOS33")),
("gpio", 4, Pins("j1:5"), IOStandard("LVCMOS33")),
("gpio", 5, Pins("j1:6"), IOStandard("LVCMOS33")),
("gpio", 3, Pins("j1:4"), IOStandard("LVCMOS33")), # Input now
("gpio", 4, Pins("j1:5"), IOStandard("LVCMOS33")), # Input now
("gpio", 5, Pins("j1:6"), IOStandard("LVCMOS33")), # Input now
("gpio", 6, Pins("j1:7"), IOStandard("LVCMOS33")),
("gpio", 7, Pins("j1:8"), IOStandard("LVCMOS33")),
("gpio", 8, Pins("j1:9"), IOStandard("LVCMOS33")),
@ -102,8 +104,8 @@ _gpios = [
# GND
# J2
("gpio", 14, Pins("j2:0"), IOStandard("LVCMOS33")),
("gpio", 15, Pins("j2:1"), IOStandard("LVCMOS33")),
("gpio", 14, Pins("j2:0"), IOStandard("LVCMOS33")), # Input now
("gpio", 15, Pins("j2:1"), IOStandard("LVCMOS33")), # Input now
("gpio", 16, Pins("j2:2"), IOStandard("LVCMOS33")),
# GND
("gpio", 17, Pins("j2:4"), IOStandard("LVCMOS33")),
@ -195,9 +197,9 @@ _gpios = [
("gpio", 85, Pins("j7:1"), IOStandard("LVCMOS33")),
("gpio", 86, Pins("j7:2"), IOStandard("LVCMOS33")),
# GND
("gpio", 87, Pins("j7:4"), IOStandard("LVCMOS33")),
("gpio", 87, Pins("j7:4"), IOStandard("LVCMOS33")), # Input now
("gpio", 88, Pins("j7:5"), IOStandard("LVCMOS33")),
("gpio", 89, Pins("j7:6"), IOStandard("LVCMOS33")),
("gpio", 89, Pins("j7:6"), IOStandard("LVCMOS33")), # Input now
("gpio", 90, Pins("j7:7"), IOStandard("LVCMOS33")),
("gpio", 91, Pins("j7:8"), IOStandard("LVCMOS33")),
("gpio", 92, Pins("j7:9"), IOStandard("LVCMOS33")),
@ -209,13 +211,13 @@ _gpios = [
# GND
# J8
("gpio", 98, Pins("j8:0"), IOStandard("LVCMOS33")),
("gpio", 99, Pins("j8:1"), IOStandard("LVCMOS33")),
("gpio", 100, Pins("j8:2"), IOStandard("LVCMOS33")),
("gpio", 98, Pins("j8:0"), IOStandard("LVCMOS33")), # Input now
("gpio", 99, Pins("j8:1"), IOStandard("LVCMOS33")), # Input now
("gpio", 100, Pins("j8:2"), IOStandard("LVCMOS33")), # Input now
# GND
("gpio", 101, Pins("j8:4"), IOStandard("LVCMOS33")),
("gpio", 102, Pins("j8:5"), IOStandard("LVCMOS33")),
("gpio", 103, Pins("j8:6"), IOStandard("LVCMOS33")),
("gpio", 101, Pins("j8:4"), IOStandard("LVCMOS33")), # Input now
("gpio", 102, Pins("j8:5"), IOStandard("LVCMOS33")), # Input now
("gpio", 103, Pins("j8:6"), IOStandard("LVCMOS33")), # Input now
("gpio", 104, Pins("j8:7"), IOStandard("LVCMOS33")),
("gpio", 105, Pins("j8:8"), IOStandard("LVCMOS33")),
("gpio", 106, Pins("j8:9"), IOStandard("LVCMOS33")),
@ -330,6 +332,49 @@ class BaseSoC(SoCCore):
ip_address = ip_address,
mac_address = mac_address,
)
# Add platform specific I/O
platform.add_extension(_gpios) # General LED outputs
# OR values for LED signalling test
# For U28
J1_1 = Signal(1) # Pins for logical evaluation
self.comb += J1_1.eq(platform.request("gpio", 0)) # Input data pins
J1_2 = Signal(1)
self.comb += J1_2.eq(platform.request("gpio", 1))
J1_3 = Signal(1)
self.comb += J1_3.eq(platform.request("gpio", 2))
J1_5 = Signal(1)
self.comb += J1_5.eq(platform.request("gpio", 3))
J1_6 = Signal(1)
self.comb += J1_6.eq(platform.request("gpio", 4))
J1_7 = Signal(1)
self.comb += J1_7.eq(platform.request("gpio", 5))
J2_1 = Signal(1)
self.comb += J2_1.eq(platform.request("gpio", 14))
J2_2 = Signal(1)
self.comb += J2_2.eq(platform.request("gpio", 15))
# For U15
J7_5 = Signal(1)
self.comb += J7_5.eq(platform.request("gpio", 87))
J7_7 = Signal(1)
self.comb += J7_7.eq(platform.request("gpio", 89))
J8_1 = Signal(1)
self.comb += J8_1.eq(platform.request("gpio", 98))
J8_2 = Signal(1)
self.comb += J8_2.eq(platform.request("gpio", 99))
J8_3 = Signal(1)
self.comb += J8_3.eq(platform.request("gpio", 100))
J8_5 = Signal(1)
self.comb += J8_5.eq(platform.request("gpio", 101))
J8_6 = Signal(1)
self.comb += J8_6.eq(platform.request("gpio", 102))
J8_7 = Signal(1)
self.comb += J8_7.eq(platform.request("gpio", 103))
# OR it all together
led_logic1 = Signal(1)
self.comb += led_logic1.eq(J1_1 | J1_2 | J1_3 | J1_5 | J1_6 | J1_7 | J2_1 | J2_2)
led_logic2 = Signal(1)
self.comb += led_logic2.eq(J8_1 | J8_2 | J8_3 | J8_5 | J8_6 | J8_7 | J7_5 | J7_7)
# Base counter (used for clocking)
counter = Signal(32) # 32-Bit counter
@ -338,10 +383,8 @@ class BaseSoC(SoCCore):
# USERLED blink (on-board LED)
# only w/ uart-name=crossover option:
if kwargs["uart_name"] not in ["serial", "bridge"]:
self.comb += platform.request("user_led_n").eq(counter[23]) # ~2Hz (?)
self.comb += platform.request("user_led_n").eq(counter[23] | led_logic1 | led_logic2) # ~2Hz
platform.add_extension(_gpios) # General LED outputs
# Adjust no. for your actual project ...
max_TABLES = 3 # 1..16
max_LEDS_per_chain = 27 # 1..256

Loading…
Cancel
Save