forked from cores/microwatt
arty_a7: Add litesdcard interface
This adds litesdcard.v generated from the litex/litesdcard project, along with logic in top-arty.vhdl to connect it into the system. There is now a DMA wishbone coming in to soc.vhdl which is narrower than the other wishbone masters (it has 32-bit data rather than 64-bit) so there is a widening/narrowing adapter between it and the main wishbone master arbiter. Also, litesdcard generates a non-pipelined wishbone for its DMA connection, which needs to be converted to a pipelined wishbone. We have a latch on both the incoming and outgoing sides of the wishbone in order to help make timing (at the cost of two extra cycles of latency). litesdcard generates an interrupt signal which is wired up to input 3 of the ICS (IRQ 19). Signed-off-by: Paul Mackerras <paulus@ozlabs.org>remove-potato-uart
parent
231003f7c7
commit
21ed730514
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
from fusesoc.capi2.generator import Generator
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
class LiteSDCardGenerator(Generator):
|
||||||
|
def run(self):
|
||||||
|
board = self.config.get('board')
|
||||||
|
|
||||||
|
# Collect a bunch of directory path
|
||||||
|
script_dir = os.path.dirname(sys.argv[0])
|
||||||
|
gen_dir = os.path.join(script_dir, "generated", board)
|
||||||
|
|
||||||
|
print("Adding LiteSDCard for board... ", board)
|
||||||
|
|
||||||
|
# Add files to fusesoc
|
||||||
|
files = []
|
||||||
|
f = os.path.join(gen_dir, "litesdcard_core.v")
|
||||||
|
files.append({f : {'file_type' : 'verilogSource'}})
|
||||||
|
|
||||||
|
self.add_files(files)
|
||||||
|
|
||||||
|
g = LiteSDCardGenerator()
|
||||||
|
g.run()
|
||||||
|
g.write()
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TARGETS=arty
|
||||||
|
|
||||||
|
ME=$(realpath $0)
|
||||||
|
echo ME=$ME
|
||||||
|
MY_PATH=$(dirname $ME)
|
||||||
|
echo MYPATH=$MY_PATH
|
||||||
|
PARENT_PATH=$(realpath $MY_PATH/..)
|
||||||
|
echo PARENT=$PARENT_PATH
|
||||||
|
BUILD_PATH=$PARENT_PATH/build
|
||||||
|
mkdir -p $BUILD_PATH
|
||||||
|
GEN_PATH=$PARENT_PATH/generated
|
||||||
|
mkdir -p $GEN_PATH
|
||||||
|
|
||||||
|
# Note litesdcard/gen.py doesn't parse a YAML file, instead it takes
|
||||||
|
# a --vendor=xxx parameter, where xxx = xilinx or lattice. If we
|
||||||
|
# want to generate litesdcard for ecp5 we'll have to invent a way to
|
||||||
|
# map arty to xilinx and ecp5 to lattice
|
||||||
|
|
||||||
|
for i in $TARGETS
|
||||||
|
do
|
||||||
|
TARGET_BUILD_PATH=$BUILD_PATH/$i
|
||||||
|
TARGET_GEN_PATH=$GEN_PATH/$i
|
||||||
|
rm -rf $TARGET_BUILD_PATH
|
||||||
|
rm -rf $TARGET_GEN_PATH
|
||||||
|
mkdir -p $TARGET_BUILD_PATH
|
||||||
|
mkdir -p $TARGET_GEN_PATH
|
||||||
|
|
||||||
|
echo "Generating $i in $TARGET_BUILD_PATH"
|
||||||
|
(cd $TARGET_BUILD_PATH && litesdcard_gen)
|
||||||
|
|
||||||
|
cp $TARGET_BUILD_PATH/build/gateware/litesdcard_core.v $TARGET_GEN_PATH/
|
||||||
|
done
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
|||||||
|
CAPI=2:
|
||||||
|
|
||||||
|
name : :microwatt:litesdcard:0
|
||||||
|
|
||||||
|
generators:
|
||||||
|
litesdcard_gen:
|
||||||
|
interpreter: python3
|
||||||
|
command: fusesoc-add-files.py
|
||||||
|
description: Generate a litesdcard SD-card controller
|
||||||
|
usage: |
|
||||||
|
litesdcard_gen adds the pre-generated LiteX LiteSDCard SD-card controller
|
||||||
|
based on the board type.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
board: The board type (arty)
|
Loading…
Reference in New Issue