1package xiangshan.backend.fu.NewCSR 2 3import chisel3._ 4 5import java.util.Properties 6 7class CommitIDModule(shaWidth: Int) extends Module { 8 val io = IO(new Bundle { 9 val commitID = Output(UInt(shaWidth.W)) 10 val dirty = Output(Bool()) 11 }) 12 13 val props = new Properties() 14 props.load((os.resource / "gitStatus").getInputStream) 15 16 val sha = props.get("SHA").asInstanceOf[String].take(shaWidth / 4) 17 val dirty = props.get("dirty").asInstanceOf[String].toInt 18 19 println(s"[CommitIDModule] SHA=$sha") 20 println(s"[CommitIDModule] dirty=$dirty") 21 22 io.commitID := BigInt(sha, 16).U(shaWidth.W) 23 io.dirty := dirty.U 24} 25