Verified Commit f21b78bc authored by Minyong Li's avatar Minyong Li 💬
Browse files

core.CanCore: use Chisel3 log2Ceil instead

parent fd7e779d
...@@ -4,19 +4,15 @@ ...@@ -4,19 +4,15 @@
package uk.ac.soton.ecs.can.core package uk.ac.soton.ecs.can.core
import chisel3._ import chisel3._
import scala.math.{ceil, log} import chisel3.util.log2Ceil
class CanCore(implicit cfg: CanCoreConfiguration) extends MultiIOModule { class CanCore(implicit cfg: CanCoreConfiguration) extends MultiIOModule {
// ========== Calculated Parameters ========== // // ========== Calculated Parameters ========== //
private val programMemoryAddressWidth = ceil( private val programMemoryAddressWidth = log2Ceil(cfg.programMemoryWords)
log(cfg.programMemoryWords) / log(2)
).toInt
private val controlWordWidth = ControlWord(programMemoryAddressWidth).getWidth private val controlWordWidth = ControlWord(programMemoryAddressWidth).getWidth
private val dataMemoryAddressWidth = ceil( private val dataMemoryAddressWidth = log2Ceil(cfg.dataMemoryWords)
log(cfg.dataMemoryWords) / log(2)
).toInt
private val blockWidth = 512 private val blockWidth = 512
// ========== External I/O Ports ========== // // ========== External I/O Ports ========== //
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment