Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
litex-boards
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel LiteX
litex-boards
Commits
b278d8bc
Commit
b278d8bc
authored
Oct 13, 2020
by
David Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CrossLink-NX VIP board platform and target
parent
8e5b3164
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
472 additions
and
0 deletions
+472
-0
litex_boards/platforms/crosslink_nx_vip.py
litex_boards/platforms/crosslink_nx_vip.py
+356
-0
litex_boards/targets/crosslink_nx_vip.py
litex_boards/targets/crosslink_nx_vip.py
+116
-0
No files found.
litex_boards/platforms/crosslink_nx_vip.py
0 → 100644
View file @
b278d8bc
This diff is collapsed.
Click to expand it.
litex_boards/targets/crosslink_nx_vip.py
0 → 100644
View file @
b278d8bc
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 David Corrigan <davidcorrigan714@gmail.com>
# Copyright (c) 2020 Alan Green <avg@google.com>
# Copyright (c) 2020 David Shah <dave@ds0.me>
#
# SPDX-License-Identifier: BSD-2-Clause
import
os
import
argparse
from
migen
import
*
from
migen.genlib.resetsync
import
AsyncResetSynchronizer
from
litex_boards.platforms
import
crosslink_nx_vip
from
litex.soc.cores.nxlram
import
NXLRAM
from
litex.soc.cores.spi_flash
import
SpiFlash
from
litex.build.io
import
CRG
from
litex.build.generic_platform
import
*
from
litex.soc.cores.clock
import
*
from
litex.soc.integration.soc_core
import
*
from
litex.soc.integration.builder
import
*
from
litex.soc.cores.led
import
LedChaser
kB
=
1024
mB
=
1024
*
kB
# CRG ----------------------------------------------------------------------------------------------
class
_CRG
(
Module
):
def
__init__
(
self
,
platform
,
sys_clk_freq
):
self
.
clock_domains
.
cd_sys
=
ClockDomain
()
self
.
clock_domains
.
cd_por
=
ClockDomain
()
# TODO: replace with PLL
# Clocking
self
.
submodules
.
sys_clk
=
sys_osc
=
NXOSCA
()
sys_osc
.
create_hf_clk
(
self
.
cd_sys
,
sys_clk_freq
)
platform
.
add_period_constraint
(
self
.
cd_sys
.
clk
,
1e9
/
sys_clk_freq
)
rst_n
=
platform
.
request
(
"gsrn"
)
# Power On Reset
por_cycles
=
4096
por_counter
=
Signal
(
log2_int
(
por_cycles
),
reset
=
por_cycles
-
1
)
self
.
comb
+=
self
.
cd_por
.
clk
.
eq
(
self
.
cd_sys
.
clk
)
self
.
sync
.
por
+=
If
(
por_counter
!=
0
,
por_counter
.
eq
(
por_counter
-
1
))
self
.
specials
+=
AsyncResetSynchronizer
(
self
.
cd_por
,
~
rst_n
)
self
.
specials
+=
AsyncResetSynchronizer
(
self
.
cd_sys
,
(
por_counter
!=
0
))
# BaseSoC ------------------------------------------------------------------------------------------
class
BaseSoC
(
SoCCore
):
SoCCore
.
mem_map
=
{
"rom"
:
0x00000000
,
"sram"
:
0x40000000
,
"csr"
:
0xf0000000
,
}
def
__init__
(
self
,
sys_clk_freq
,
**
kwargs
):
platform
=
crosslink_nx_vip
.
Platform
()
platform
.
add_platform_command
(
"ldc_set_sysconfig {{MASTER_SPI_PORT=SERIAL}}"
)
# Disable Integrated SRAM since we want to instantiate LRAM specifically for it
kwargs
[
"integrated_sram_size"
]
=
0
# SoCCore -----------------------------------------_----------------------------------------
SoCCore
.
__init__
(
self
,
platform
,
sys_clk_freq
,
ident
=
"LiteX SoC on Crosslink-NX VIP Input Board"
,
ident_version
=
True
,
**
kwargs
)
# CRG --------------------------------------------------------------------------------------
self
.
submodules
.
crg
=
_CRG
(
platform
,
sys_clk_freq
)
# 128KB LRAM (used as SRAM) ---------------------------------------------------------------
size
=
128
*
kB
self
.
submodules
.
spram
=
NXLRAM
(
32
,
size
)
self
.
register_mem
(
"sram"
,
self
.
mem_map
[
"sram"
],
self
.
spram
.
bus
,
size
)
# Leds -------------------------------------------------------------------------------------
self
.
submodules
.
leds
=
LedChaser
(
pads
=
Cat
(
*
[
platform
.
request
(
"user_led"
,
i
)
for
i
in
range
(
4
)]),
sys_clk_freq
=
sys_clk_freq
)
self
.
add_csr
(
"leds"
)
# Build --------------------------------------------------------------------------------------------
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
"LiteX SoC on Crosslink-NX Eval Board"
)
parser
.
add_argument
(
"--build"
,
action
=
"store_true"
,
help
=
"Build bitstream"
)
parser
.
add_argument
(
"--load"
,
action
=
"store_true"
,
help
=
"Load bitstream"
)
parser
.
add_argument
(
"--sys-clk-freq"
,
default
=
75e6
,
help
=
"System clock frequency (default=75MHz)"
)
parser
.
add_argument
(
"--prog-target"
,
default
=
"direct"
,
help
=
"Programming Target: direct or flash"
)
builder_args
(
parser
)
soc_core_args
(
parser
)
args
=
parser
.
parse_args
()
soc
=
BaseSoC
(
sys_clk_freq
=
int
(
float
(
args
.
sys_clk_freq
)),
**
soc_core_argdict
(
args
))
builder
=
Builder
(
soc
,
**
builder_argdict
(
args
))
builder_kargs
=
{}
builder
.
build
(
**
builder_kargs
,
run
=
args
.
build
)
if
args
.
load
:
prog
=
soc
.
platform
.
create_programmer
(
args
.
prog_target
)
prog
.
load_bitstream
(
os
.
path
.
join
(
builder
.
gateware_dir
,
soc
.
build_name
+
".bit"
))
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment