Compare commits

..

15 Commits

Author SHA1 Message Date
552553e526 Load 32 MiB bootimage from a 2048 sector offset (first partiton) 2018-06-13 00:34:19 +02:00
ee888b8c7b Rebuild when changing the bootloader 2018-06-13 00:33:46 +02:00
c812a8878f Properly set clock frequencies 2018-06-06 01:05:36 +02:00
2c74ef7f03 Use correct frequency for the sd-spi interface 2018-05-19 19:04:56 +02:00
c27ee2215c Print everything send over serial to the terminal 2018-05-19 19:04:11 +02:00
ec4e3ec36d Use rocket config with fpu and mmu for booting linux 2018-05-19 19:00:57 +02:00
87bb3a5f24 Use correct clock period and memory size in config 2018-05-14 20:10:08 +02:00
a3f166d5a2 Pull in memory and terminal improvements 2018-05-14 20:09:55 +02:00
175ed051d3 Pull in the new XilinxML507MIGToTL implementation 2018-05-10 21:43:51 +02:00
291a765b8d Switch to new XilinxML507MIG and connect top level signals 2018-05-10 00:37:00 +02:00
7b46ed6b7c Move ml507 mig TL stub into fpga-shells 2018-05-09 23:22:53 +02:00
0cb89fd675 Add fragmenter in front of TLMemoryML507 and implementation notes 2018-05-03 01:57:06 +02:00
7a514c6477 Point all submodules to tiband 2018-05-01 00:14:53 +02:00
e57dfd0f63 Update rocket-chip to fix rom generation 2018-05-01 00:11:11 +02:00
df44d1a3bc Make DIP switches available as GPIO register 2018-05-01 00:09:14 +02:00
11 changed files with 28 additions and 73 deletions

4
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "rocket-chip"]
path = rocket-chip
url = https://github.com/ucb-bar/rocket-chip.git
url = https://git.tiband.de/riscv/rocket-chip.git
[submodule "sifive-blocks"]
path = sifive-blocks
url = https://github.com/sifive/sifive-blocks.git
url = https://git.tiband.de/riscv/sifive-blocks.git
[submodule "fpga-shells"]
path = fpga-shells
url = https://git.tiband.de/riscv/fpga-shells.git

View File

@ -33,6 +33,9 @@ static inline void kputc(char c)
while ((int32_t)(*tx) < 0);
*tx = c;
#endif
volatile uint32_t *term = (void *) 0x64003000; // Terminal (32 bit)
while ((int32_t)(*term) < 0);
*term = c;
}
extern void kputs(const char *);

View File

@ -10,9 +10,13 @@
#define MAX_CORES 8
#define PAYLOAD_SIZE (16 << 11)
//#define PAYLOAD_START 0
//#define PAYLOAD_CRC7 0xE1
#define PAYLOAD_START 2048
#define PAYLOAD_CRC7 0x51
#define PAYLOAD_SIZE (16 << 12)
#define F_CLK 50000000UL
#define F_CLK 60000000UL
static volatile uint32_t * const spi = (void *)(SPI_CTRL_ADDR);
@ -163,7 +167,7 @@ static int copy(void)
kprintf("LOADING ");
REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 20000000UL);
if (sd_cmd(0x52, 0, 0xE1) != 0x00) {
if (sd_cmd(0x52, PAYLOAD_START, PAYLOAD_CRC7) != 0x00) {
sd_cmd_end();
return 1;
}

View File

@ -63,7 +63,7 @@ endif
verilog: $(verilog)
romgen := $(BUILD_DIR)/$(CONFIG_PROJECT).$(CONFIG).rom.v
$(romgen): $(verilog)
$(romgen): $(verilog) $(BOOTROM_DIR)
ifneq ($(BOOTROM_DIR),"")
$(MAKE) -C $(BOOTROM_DIR) romgen
mv $(BUILD_DIR)/rom.v $@

View File

@ -14,14 +14,15 @@ import sifive.blocks.devices.spi._
import sifive.blocks.devices.uart._
import sifive.blocks.devices.terminal._
import sifive.freedom.unleashed.u500ml507devkit.fpga._
import sifive.fpgashells.devices.xilinx.xilinxml507mig._
// Default FreedomUML507Config
class FreedomUML507Config extends Config(
new WithoutTLMonitors ++
new WithJtagDTM ++
new WithClockFrequency(60000000) ++ // 60 MHz
new WithNMemoryChannels(1) ++
new WithNBigCores(1) ++
new WithNSmallLinuxCores(1) ++
new BaseConfig
)
@ -45,10 +46,9 @@ class U500ML507DevKitConfig extends Config(
new U500ML507DevKitPeripherals ++
new FreedomUML507Config().alter((site,here,up) => {
case ErrorParams => ErrorParams(Seq(AddressSet(0x3000, 0xfff)), maxAtomic=site(XLen)/8, maxTransfer=128)
case PeripheryBusKey => up(PeripheryBusKey, site).copy(frequency = 50000000) // 50 MHz hperiphery
case MemoryML507Key => MemoryML507Params(address = Seq(AddressSet(0x80000000L,0x10000000L-1))) // 256 MiB
case MemoryML507Key => XilinxML507MIGParams(address = Seq(AddressSet(0x80000000L,0x10000000L-1))) // 256 MiB
case DTSTimebase => BigInt(1000000)
case ExtMem => up(ExtMem).copy(size = 0x40000000L)
case ExtMem => up(ExtMem).copy(size = 0x10000000L)
case JtagDTMKey => new JtagDTMConfig (
idcodeVersion = 2, // 1 was legacy (FE310-G000, Acai).
idcodePartNum = 0x000, // Decided to simplify.

View File

@ -42,6 +42,7 @@ class U500ML507DevKitFPGAChip(implicit override val p: Parameters)
//---------------------------------------------------------------------
connectTerminal (dut)
connectDDRMemory(dut)
connectDebugJTAG(dut)
connectSPI (dut)
connectUART (dut)
@ -55,9 +56,10 @@ class U500ML507DevKitFPGAChip(implicit override val p: Parameters)
GPIOPinsFromPort(gpio_pins, dut.gpio(0))
gpio_pins.pins.foreach { _.i.ival := Bool(false) }
gpio_pins.pins.zipWithIndex.foreach {
case(pin, idx) => led(idx) := pin.o.oval
case(pin, idx) =>
pin.i.ival := dip(idx)
led(idx) := pin.o.oval
}
}

View File

@ -15,7 +15,7 @@ import sifive.blocks.devices.spi._
import sifive.blocks.devices.uart._
import sifive.blocks.devices.terminal._
import sifive.freedom.unleashed.u500ml507devkit.fpga._
import sifive.fpgashells.devices.xilinx.xilinxml507mig._
//-------------------------------------------------------------------------
// U500ML507DevKitSystem
@ -40,7 +40,8 @@ class U500ML507DevKitSystemModule[+L <: U500ML507DevKitSystem](_outer: L)
with HasPeripheryUARTModuleImp
with HasPeripheryTerminalModuleImp
with HasPeripherySPIModuleImp
with HasPeripheryGPIOModuleImp {
with HasPeripheryGPIOModuleImp
with HasMemoryML507ModuleImp {
// Reset vector is set to the location of the mask rom
val maskROMParams = p(PeripheryMaskROMKey)
global_reset_vector := maskROMParams(0).address.U

View File

@ -1,55 +0,0 @@
// See LICENSE.SiFive for license details.
package sifive.freedom.unleashed.u500ml507devkit.fpga
import Chisel._
import freechips.rocketchip.config.{Field, Parameters}
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.subsystem.BaseSubsystem
import freechips.rocketchip.tilelink._
import freechips.rocketchip.util._
case class MemoryML507Params(
address: Seq[AddressSet]
)
case object MemoryML507Key extends Field[MemoryML507Params]
trait HasMemoryML507 { this: BaseSubsystem =>
val memory = LazyModule(new TLMemoryML507(p(MemoryML507Key)))
// TODO: right TL/memory node chain?
memory.node := memBuses.head.toDRAMController(Some("ml507mig"))()
}
class TLMemoryML507(c: MemoryML507Params)(implicit p: Parameters) extends LazyModule {
val width = 512
val beatBytes = width/8 // TODO: To wide? TLFragmenter? fixedSize?
val device = new MemoryDevice
val node = TLManagerNode(
Seq(TLManagerPortParameters(
Seq(TLManagerParameters(
address = c.address,
resources = device.reg,
regionType = RegionType.UNCACHED,
executable = true,
supportsGet = TransferSizes(1, beatBytes),
supportsPutFull = TransferSizes(1, beatBytes),
fifoId = Some(0) // in-order
)),
beatBytes = beatBytes
))
)
lazy val module = new LazyModuleImp(this) {
val (in, edge)= node.in(0)
// Tie off unused channels
in.a.ready := Bool(false)
in.b.valid := Bool(false)
in.c.ready := Bool(false)
in.d.valid := Bool(false)
in.e.ready := Bool(false)
}
}