sifive / freedom

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

How to add Inclusive cache to Freedom? #144

Open yintianyu opened 4 years ago

yintianyu commented 4 years ago

I'm in Branch bump-stuff.

I can successfully add Inclusive cache to Rocket-Chip by adding this to system/Configs.scala.

class L2CacheConfig extends Config(new WithInclusiveCache ++ new DefaultConfig)

However, when I modify freedom's unleashed/DevKitConfigs.scala like this:

// Default FreedomU500Config
class FreedomU500Config extends Config(
  new WithJtagDTM            ++
  new WithNMemoryChannels(1) ++
//  new WithNBigCores(1)       ++
//  new BaseConfig
  new L2CacheConfig
)

It failed when generating verilog:

[error] (run-main-0) java.lang.IllegalArgumentException: requirement failed: AcquireB(TransferSizes[1, 64]) < AcquireT(TransferSizes[1, 128])
[error] java.lang.IllegalArgumentException: requirement failed: AcquireB(TransferSizes[1, 64]) < AcquireT(TransferSizes[1, 128])
[error]     at scala.Predef$.require(Predef.scala:277)
[error]     at freechips.rocketchip.tilelink.TLManagerParameters.<init>(Parameters.scala:48)
[error]     at freechips.rocketchip.tilelink.TLManagerParameters.copy(Parameters.scala:37)
[error]     at freechips.rocketchip.tilelink.TLCacheCork.$anonfun$node$5(CacheCork.scala:22)
[error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
[error]     at scala.collection.immutable.List.foreach(List.scala:389)
[error]     at scala.collection.TraversableLike.map(TraversableLike.scala:234)
[error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
[error]     at scala.collection.immutable.List.map(List.scala:295)
[error]     at freechips.rocketchip.tilelink.TLCacheCork.$anonfun$node$3(CacheCork.scala:22)
[error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
[error]     at scala.collection.immutable.List.foreach(List.scala:389)
[error]     at scala.collection.TraversableLike.map(TraversableLike.scala:234)
[error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
[error]     at scala.collection.immutable.List.map(List.scala:295)
[error]     at freechips.rocketchip.diplomacy.MixedAdapterNode.mapParamsU(Nodes.scala:481)
[error]     at freechips.rocketchip.diplomacy.MixedNode.liftedTree3$1(Nodes.scala:354)
[error]     at freechips.rocketchip.diplomacy.MixedNode.uiParams$lzycompute(Nodes.scala:351)
[error]     at freechips.rocketchip.diplomacy.MixedNode.uiParams(Nodes.scala:350)
...

Does anyone know how to solve this?

erikdanie commented 4 years ago

This probably means that you need to put in a TLFragmenter (https://github.com/chipsalliance/rocket-chip/blob/master/src/main/scala/tilelink/Fragmenter.scala#L26) to convert the larger transactions down. You can search freedom and rocket-chip for some examples of how it is used.