sifive / freedom

Source files for SiFive's Freedom platforms
Apache License 2.0
1.11k stars 284 forks source link

how to add MMIO peripherals to U500 design #158

Open shirlynan opened 4 years ago

shirlynan commented 4 years ago

Hi everyone, I'm struggling with adding a custom MMIO peripheral to Freedom U500 design. I'm using a gcd example from the chipyard branch, however, I cant see my custom peripheral in the generated verilog files or memory map. So I think I missed something. What I have done is describe the GCD module under the rocket-chip folder and then instantiate it with the following code in Configs.scala in rocket-chip/src/main/scala/subsystem folder. class WithGCD(useAXI4: Boolean, useBlackBox: Boolean) extends Config((site, here, up) => { case GCDKey => Some(GCDParams(useAXI4 = useAXI4, useBlackBox = useBlackBox)) }) and add this config with the code new WithGCD(useAXI4=false, useBlackBox=true) ++ to the BaseConfig of rocket-chip. I'm not sure if I did the instantiation in a wrong way... It would be great if someone could give me a clue to solve this problem. Unfortunately, I cant find an tutorial for this purpose.

Thanks for your help.

JohnsonZ-microe commented 4 years ago

Your need to connect your MMIO ports to the top module, or it will be removed by FIRRTL' s optimization. I m struggling with this problem too, I have solved the problem you just met but unfortunately get stuck with the problem of Pins definition.