2020-08-23 09:00:17 -04:00
|
|
|
#
|
|
|
|
# This file is part of LiteX-Boards.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2020 Paul Sajna <sajattack@gmail.com>
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
2020-01-25 06:00:57 -05:00
|
|
|
|
|
|
|
from litex.build.generic_platform import *
|
|
|
|
from litex.build.altera import AlteraPlatform
|
|
|
|
from litex.build.altera.programmer import USBBlaster
|
|
|
|
|
|
|
|
# IOs ----------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
_io = [
|
2020-11-03 04:48:41 -05:00
|
|
|
# Clk / Rst
|
2020-01-25 06:00:57 -05:00
|
|
|
("clk50", 0, Pins("V11"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("clk50", 1, Pins("Y13"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("clk50", 2, Pins("E11"), IOStandard("3.3-V LVTTL")),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Leds
|
2020-04-09 14:02:02 -04:00
|
|
|
("user_led", 0, Pins("W15"), IOStandard("3.3-V LVTTL")),
|
2020-01-25 06:00:57 -05:00
|
|
|
("user_led", 1, Pins("AA24"), IOStandard("3.3-V LVTTL")),
|
2020-04-09 14:02:02 -04:00
|
|
|
("user_led", 2, Pins("V16"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("user_led", 3, Pins("V15"), IOStandard("3.3-V LVTTL")),
|
2020-01-25 06:00:57 -05:00
|
|
|
("user_led", 4, Pins("AF26"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("user_led", 5, Pins("AE26"), IOStandard("3.3-V LVTTL")),
|
2020-07-24 03:03:35 -04:00
|
|
|
("user_led", 6, Pins("Y16"), IOStandard("3.3-V LVTTL")),
|
2020-06-08 06:05:36 -04:00
|
|
|
("user_led", 7, Pins("AA23"), IOStandard("3.3-V LVTTL")),
|
2020-01-25 06:00:57 -05:00
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Buttons
|
2020-01-25 06:00:57 -05:00
|
|
|
("key", 0, Pins("AH17"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("key", 1, Pins("AH16"), IOStandard("3.3-V LVTTL")),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Switches
|
2020-01-30 08:01:46 -05:00
|
|
|
("user_sw", 0, Pins("Y24"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("user_sw", 1, Pins("W24"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("user_sw", 2, Pins("W21"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("user_sw", 3, Pins("W20"), IOStandard("3.3-V LVTTL")),
|
2020-01-25 06:00:57 -05:00
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Serial
|
2020-01-25 06:00:57 -05:00
|
|
|
("serial", 0,
|
2020-07-24 03:03:35 -04:00
|
|
|
Subsignal("tx", Pins("AH9"), IOStandard("3.3-V LVTTL")), # User I/O port on Mister
|
|
|
|
Subsignal("rx", Pins("AG11"), IOStandard("3.3-V LVTTL")) # User I/O port on Mister
|
2020-01-25 06:00:57 -05:00
|
|
|
),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Serial
|
2020-06-11 13:54:55 -04:00
|
|
|
("serial", 1,
|
2020-07-24 03:03:35 -04:00
|
|
|
Subsignal("tx", Pins("AF13"), IOStandard("3.3-V LVTTL")), # Arduino_IO1
|
|
|
|
Subsignal("rx", Pins("AG13"), IOStandard("3.3-V LVTTL")) # Arduino_IO0
|
2020-06-11 13:54:55 -04:00
|
|
|
),
|
2020-06-08 06:05:36 -04:00
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Accelerometer
|
|
|
|
("acc", 0,
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("int", Pins("A17")),
|
2020-01-25 06:00:57 -05:00
|
|
|
Subsignal("sclk", Pins("C18")),
|
|
|
|
Subsignal("sdat", Pins("A19")),
|
|
|
|
IOStandard("3.3-V LVTTL")
|
|
|
|
),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# ADC
|
2020-01-25 06:00:57 -05:00
|
|
|
("adc", 0,
|
|
|
|
Subsignal("convst", Pins("U9")),
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("sclk", Pins("V10")),
|
|
|
|
Subsignal("sdi", Pins("AC4")),
|
|
|
|
Subsignal("sdo", Pins("AD4")),
|
2020-01-25 06:00:57 -05:00
|
|
|
IOStandard("3.3-V LVTTL")
|
|
|
|
),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# HDMI
|
2020-01-25 06:00:57 -05:00
|
|
|
("hdmi", 0,
|
2020-07-24 03:03:35 -04:00
|
|
|
Subsignal("tx_d_r", Pins("AS12 AE12 W8 Y8 AD11 AD10 AE11 Y5")),
|
|
|
|
Subsignal("tx_d_g", Pins("AF10 Y4 AE9 AB4 AE7 AF6 AF8 AF5")),
|
|
|
|
Subsignal("tx_d_b", Pins("AE4 AH2 AH4 AH5 AH6 AG6 AF9 AE8")),
|
|
|
|
Subsignal("tx_clk", Pins("AG5")),
|
|
|
|
Subsignal("tx_de", Pins("AD19")),
|
|
|
|
Subsignal("tx_hs", Pins("T8")),
|
|
|
|
Subsignal("tx_vs", Pins("V13")),
|
2020-01-25 06:00:57 -05:00
|
|
|
Subsignal("tx_int", Pins("AF11")),
|
2020-07-24 03:03:35 -04:00
|
|
|
Misc("FAST_OUTPUT_REGISTER ON"),
|
2020-01-25 06:00:57 -05:00
|
|
|
IOStandard("3.3-V LVTTL")
|
|
|
|
),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# I2C
|
2020-06-08 06:05:36 -04:00
|
|
|
("i2c", 0,
|
|
|
|
Subsignal("scl", Pins("U10")),
|
|
|
|
Subsignal("sda", Pins("AA4")),
|
2020-01-25 06:00:57 -05:00
|
|
|
IOStandard("3.3-V LVTTL")
|
|
|
|
),
|
2020-06-08 06:05:36 -04:00
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# I2S
|
2020-06-08 06:05:36 -04:00
|
|
|
("i2s", 0,
|
|
|
|
Subsignal("i2s", Pins("T13")),
|
|
|
|
Subsignal("mclk", Pins("U11")),
|
|
|
|
Subsignal("lrclk", Pins("T11")),
|
|
|
|
Subsignal("sclk", Pins("T12")),
|
2020-01-25 06:00:57 -05:00
|
|
|
IOStandard("3.3-V LVTTL")
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# MiSTer extension board (https://github.com/MiSTer-devel/Main_MiSTer/wiki) ------------------------
|
|
|
|
|
2020-01-29 16:59:57 -05:00
|
|
|
_mister_sdram_module_io = [
|
2020-11-03 04:48:41 -05:00
|
|
|
# SDR SDRAM
|
2020-01-29 16:59:57 -05:00
|
|
|
("sdram_clock", 0, Pins("AD20"), IOStandard("3.3-V LVTTL")),
|
|
|
|
("sdram", 0,
|
|
|
|
Subsignal("cke", Pins("AG10")),
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("a", Pins(
|
|
|
|
"Y11 AA26 AA13 AA11 W11 Y19 AB23 AC23",
|
|
|
|
"AC22 C12 AB26 AD17 D12")),
|
|
|
|
Subsignal("dq", Pins(
|
|
|
|
"E8 V12 D11 W12 AH13 D8 AH14 AF7",
|
2020-07-24 05:27:25 -04:00
|
|
|
"AE24 AD23 AE6 AE23 AG14 AD5 AF4 AH3"),
|
2020-07-24 06:27:36 -04:00
|
|
|
Misc("FAST_OUTPUT_ENABLE_REGISTER ON"),
|
2020-07-24 05:27:25 -04:00
|
|
|
Misc("FAST_INPUT_REGISTER ON")),
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("ba", Pins("Y17 AB25")),
|
2020-01-29 16:59:57 -05:00
|
|
|
Subsignal("cas_n", Pins("AA18")),
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("cs_n", Pins("Y18")),
|
2020-01-29 16:59:57 -05:00
|
|
|
Subsignal("ras_n", Pins("W14")),
|
2020-04-09 14:02:02 -04:00
|
|
|
Subsignal("we_n", Pins("AA19")),
|
2020-07-24 06:27:36 -04:00
|
|
|
Misc("CURRENT_STRENGTH_NEW \"MAXIMUM CURRENT\""),
|
2020-07-24 03:03:35 -04:00
|
|
|
Misc("FAST_OUTPUT_REGISTER ON"),
|
2020-07-24 06:27:36 -04:00
|
|
|
Misc("ALLOW_SYNCH_CTRL_USAGE OFF"),
|
2020-07-24 03:03:35 -04:00
|
|
|
IOStandard("3.3-V LVTTL"),
|
2020-01-29 16:59:57 -05:00
|
|
|
),
|
2020-03-18 08:11:57 -04:00
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# SDCard
|
2020-03-19 06:09:48 -04:00
|
|
|
("spisdcard", 0,
|
|
|
|
Subsignal("clk", Pins("AH26")),
|
|
|
|
Subsignal("cs_n", Pins("AF28")),
|
2020-07-24 03:03:35 -04:00
|
|
|
Subsignal("mosi", Pins("AF27"), Misc("WEAK_PULL_UP_RESISTOR ON")),
|
|
|
|
Subsignal("miso", Pins("AF25"), Misc("WEAK_PULL_UP_RESISTOR ON")),
|
|
|
|
IOStandard("3.3-V LVTTL")
|
2020-07-23 09:40:04 -04:00
|
|
|
),
|
2020-07-24 03:03:35 -04:00
|
|
|
|
2020-07-23 09:40:04 -04:00
|
|
|
("sdcard", 0,
|
|
|
|
Subsignal("data", Pins("AF25 AF23 AD26 AF28"), Misc("WEAK_PULL_UP_RESISTOR ON")),
|
|
|
|
Subsignal("cmd", Pins("AF27"), Misc("WEAK_PULL_UP_RESISTOR ON")),
|
|
|
|
Subsignal("clk", Pins("AH26")),
|
2020-07-24 03:03:35 -04:00
|
|
|
Subsignal("cd", Pins("AH7")),
|
|
|
|
Misc("FAST_OUTPUT_REGISTER ON"),
|
|
|
|
IOStandard("3.3-V LVTTL"),
|
2020-03-18 08:11:57 -04:00
|
|
|
),
|
2020-06-08 06:05:36 -04:00
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# Outputs
|
2020-06-08 06:05:36 -04:00
|
|
|
("mister_outputs", 0,
|
|
|
|
Subsignal("led_user", Pins("Y15")),
|
|
|
|
Subsignal("led_hdd", Pins("AA15")),
|
|
|
|
Subsignal("led_power", Pins("AG28")),
|
2020-07-24 03:03:35 -04:00
|
|
|
IOStandard("3.3-V LVTTL")
|
2020-06-08 06:05:36 -04:00
|
|
|
),
|
|
|
|
|
2020-11-03 04:48:41 -05:00
|
|
|
# VGA
|
2020-06-08 06:05:36 -04:00
|
|
|
("vga", 0,
|
2021-03-03 12:05:24 -05:00
|
|
|
Subsignal("en", Pins("AH27")),
|
|
|
|
Subsignal("hsync_n", Pins("AH22")),
|
|
|
|
Subsignal("vsync_n", Pins("AG24")),
|
|
|
|
Subsignal("r", Pins("AE17 AE20 AF20 AH18 AH19 AF21")),
|
|
|
|
Subsignal("g", Pins("AE19 AG15 AF18 AG18 AG19 AG20")),
|
|
|
|
Subsignal("b", Pins("AG21 AA20 AE22 AF22 AH23 AH21")),
|
2020-07-24 03:03:35 -04:00
|
|
|
IOStandard("3.3-V LVTTL")
|
2020-06-08 06:05:36 -04:00
|
|
|
),
|
2020-01-29 16:59:57 -05:00
|
|
|
]
|
|
|
|
|
2020-01-25 06:00:57 -05:00
|
|
|
# Platform -----------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class Platform(AlteraPlatform):
|
2020-04-09 14:02:02 -04:00
|
|
|
default_clk_name = "clk50"
|
2020-01-25 06:00:57 -05:00
|
|
|
default_clk_period = 1e9/50e6
|
|
|
|
|
|
|
|
def __init__(self):
|
2020-01-30 06:41:44 -05:00
|
|
|
AlteraPlatform.__init__(self, "5CSEBA6U23I7", _io)
|
|
|
|
self.add_extension(_mister_sdram_module_io)
|
2020-01-25 06:00:57 -05:00
|
|
|
|
|
|
|
def create_programmer(self):
|
2021-02-12 09:23:17 -05:00
|
|
|
return USBBlaster(cable_name="DE-SoC", device_id=2)
|
2020-05-05 05:45:41 -04:00
|
|
|
|
|
|
|
def do_finalize(self, fragment):
|
|
|
|
AlteraPlatform.do_finalize(self, fragment)
|
|
|
|
self.add_period_constraint(self.lookup_request("clk50", 0, loose=True), 1e9/50e6)
|
|
|
|
self.add_period_constraint(self.lookup_request("clk50", 1, loose=True), 1e9/50e6)
|
|
|
|
self.add_period_constraint(self.lookup_request("clk50", 2, loose=True), 1e9/50e6)
|