Skip to content

Commit

Permalink
fix issue #20: PWMConfig elaboration error due to requirement failure
Browse files Browse the repository at this point in the history
  • Loading branch information
zhemao committed Feb 23, 2018
1 parent e3f0501 commit eaff48e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/scala/example/PWM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,24 @@ trait PWMTLModule extends HasRegMap {
implicit val p: Parameters
def params: PWMParams

val w = params.beatBytes * 8
require(w <= 32)

// How many clock cycles in a PWM cycle?
val period = Reg(UInt(w.W))
val period = Reg(UInt(32.W))
// For how many cycles should the clock be high?
val duty = Reg(UInt(w.W))
val duty = Reg(UInt(32.W))
// Is the PWM even running at all?
val enable = RegInit(false.B)

val base = Module(new PWMBase(w))
val base = Module(new PWMBase(32))
io.pwmout := base.io.pwmout
base.io.period := period
base.io.duty := duty
base.io.enable := enable

regmap(
0x00 -> Seq(
RegField(w, period)),
RegField(32, period)),
0x04 -> Seq(
RegField(w, duty)),
RegField(32, duty)),
0x08 -> Seq(
RegField(1, enable)))
}
Expand Down

0 comments on commit eaff48e

Please sign in to comment.