From c8677cca9b751bae08a4d822191fcc69252b9c82 Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Sat, 26 May 2018 11:32:36 +0200 Subject: [PATCH] Better HexTools --- src/main/scala/vexriscv/demo/MuraxUtiles.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/scala/vexriscv/demo/MuraxUtiles.scala b/src/main/scala/vexriscv/demo/MuraxUtiles.scala index 80e0922..3a32a74 100644 --- a/src/main/scala/vexriscv/demo/MuraxUtiles.scala +++ b/src/main/scala/vexriscv/demo/MuraxUtiles.scala @@ -74,7 +74,7 @@ class MuraxMasterArbiter(simpleBusConfig : SimpleBusConfig) extends Component{ } object HexTools{ - def readHexFile(path : String, callback : (Int, Int) => Unit): Unit ={ + def readHexFile(path : String, callback : (Int, Int) => Unit, offset : Int = 0): Unit ={ import scala.io.Source def hToI(that : String, start : Int, size : Int) = Integer.parseInt(that.substring(start,start + size), 16) @@ -87,7 +87,7 @@ object HexTools{ key match { case 0 => for(i <- 0 until byteCount){ - callback(nextAddr + i, hToI(line, 9 + i * 2, 2)) + callback(nextAddr + i + offset, hToI(line, 9 + i * 2, 2)) } case 2 => offset = hToI(line, 9, 4) << 4 @@ -101,8 +101,6 @@ object HexTools{ } } - - def initRam[T <: Data](ram : Mem[T], onChipRamHexFile : String, ramOffset : BigInt): Unit ={ val initContent = Array.fill[BigInt](ram.wordCount)(0) HexTools.readHexFile(onChipRamHexFile,(address,data) => {