Skip to content
Snippets Groups Projects
Verified Commit f21b78bc authored by Minyong Li's avatar Minyong Li :speech_balloon:
Browse files

core.CanCore: use Chisel3 log2Ceil instead

parent fd7e779d
No related branches found
No related tags found
No related merge requests found
...@@ -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 ========== //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment