TileLinkの生成フローについて調査を進めている。まずはTileLinkを使った独自のデザインを生成する環境を整えていく。
class TLOriginalRAMSimple(ramBeatBytes: Int, txns: Int)(implicit p: Parameters) extends LazyModule { val fuzz = LazyModule(new TLFuzzer(txns)) val model = LazyModule(new TLRAMModel("SRAMSimple")) val ram = LazyModule(new TLRAM(AddressSet(0x0, 0x3ff), beatBytes = ramBeatBytes)) ram.node := TLDelayer(0.25) := model.node := fuzz.node lazy val module = new LazyModuleImp(this) with UnitTestModule { io.finished := fuzz.module.io.finished } } class TLOriginalRAMSimpleTest(ramBeatBytes: Int, txns: Int = 5000, timeout: Int = 500000)(implicit p: Parameters) extends UnitTest(timeout) { val dut = Module(LazyModule(new TLOriginalRAMSimple(ramBeatBytes, txns)).module) io.finished := dut.io.finished } class WithTLOriginalUnitTest extends Config((site, here, up) => { case UnitTests => (q: Parameters) => { implicit val p = q val txns = 1 * site(TestDurationMultiplier) val timeout = 50000 * site(TestDurationMultiplier) Seq( Module(new TLOriginalRAMSimpleTest(4, txns=15*txns, timeout=timeout)) )} }) class TLOriginalUnitTestConfig extends Config(new WithTLOriginalUnitTest ++ new WithTestDuration(1) ++ new BaseSubsystemConfig)
バス幅は以下のようになった。
TLFuzzer
信号 | ビット数 | 説明 |
---|---|---|
a_bits_opcode |
3 | Operation code. Identifies the type of message carried by the channel. |
a_bits_size |
1 | Logarithm of the operation size: 2n bytes. |
a_bits_source |
5 | Unique, per-link master source identifier. |
a_bits_address |
10 | Target byte address of the operation. Must be aligned to a size. |
a_bits_mask |
1 | Byte lane select for messages with data. |
a_bits_data |
8 | Data payload for messages with data. |
d_bits_source |
5 | Unique, per-link master source identifier. |
TLRAM
信号 | ビット数 | 説明 |
---|---|---|
a_bits_opcode |
3 | Operation code. Identifies the type of message carried by the channel. |
a_bits_param |
3 | Parameter code. Meaning depends on a opcode; specifies a transfer of caching permissions or a sub-opcode. |
a_bits_size |
1 | Logarithm of the operation size: 2n bytes. |
a_bits_source |
5 | Unique, per-link master source identifier. |
a_bits_address |
10 | Target byte address of the operation. Must be aligned to a size. |
a_bits_mask |
1 | Byte lane select for messages with data. |
a_bits_data |
8 | Data payload for messages with data. |
d_bits_opcode |
3 | Operation code. Identifies the type of message carried by the channel. |
d_bits_size |
1 | Logarithm of the operation size: 2n bytes. |
d_bits_source |
5 | Unique, per-link master source identifier. |
d_bits_data |
8 | Data payload for messages with data. |
次に、バス幅を32ビットに変更したときにどのようにVerilogが変化するか確認する。
diff --git a/chisel-hw/src/main/scala/TLUnitTest/TLUnitTest.scala b/chisel-hw/src/main/scala/TLUnitTest/TLUnitTest.scala index b6e09a9..77fefb9 100644 --- a/chisel-hw/src/main/scala/TLUnitTest/TLUnitTest.scala +++ b/chisel-hw/src/main/scala/TLUnitTest/TLUnitTest.scala @@ -40,7 +40,7 @@ class WithTLOriginalUnitTest extends Config((site, here, up) => { val txns = 1 * site(TestDurationMultiplier) val timeout = 50000 * site(TestDurationMultiplier) Seq( - Module(new TLOriginalRAMSimpleTest(1, txns=15*txns, timeout=timeout)) + Module(new TLOriginalRAMSimpleTest(4, txns=15*txns, timeout=timeout)) )} })
そのままバイトサイズと様々な信号のビット幅に影響が出た。32ビットだと以下のように影響が出る。
信号 | ビット数(8-bit) | ビット数(32-bit) | 説明 |
---|---|---|---|
a_bits_opcode |
3 | 3 | Operation code. Identifies the type of message carried by the channel. |
a_bits_param |
3 | 3 | Parameter code. Meaning depends on a opcode; specifies a transfer of caching permissions or a sub-opcode. |
a_bits_size |
1 | 2 | Logarithm of the operation size: 2n bytes. |
a_bits_source |
5 | 5 | Unique, per-link master source identifier. |
a_bits_address |
10 | 10 | Target byte address of the operation. Must be aligned to a size. |
a_bits_mask |
1 | 4 | Byte lane select for messages with data. |
a_bits_data |
8 | 32 | Data payload for messages with data. |
d_bits_opcode |
3 | 3 | Operation code. Identifies the type of message carried by the channel. |
d_bits_size |
1 | 2 | Logarithm of the operation size: 2n bytes. |
d_bits_source |
5 | 5 | Unique, per-link master source identifier. |
d_bits_data |
8 | 32 | Data payload for messages with data. |
Diplomacyの構築状況をGraphMLで確認する
Diplomacyの構成状況は、GraphMLにより出力することができる。GrapMLの出力方法について確認する。
まずはTLOriginalRAMSimpleTest
の構成を変更する。
class TLOriginalRAMSimpleTest(ramBeatBytes: Int, txns: Int = 5000, timeout: Int = 500000)(implicit p: Parameters) extends UnitTest(timeout) { val lazy_dut = LazyModule(new TLOriginalRAMSimple(ramBeatBytes, txns) val dut = Module(lazy_dut).module) ElaborationArtefacts.add("graphml", lazy_dut.graphML) io.finished := dut.io.finished }
lazy_dut
によりLazyModule
を生成し、lazy_dut
に対してgraphml
を生成する。それがElaborationArtefacts.add("graphml", lazy_dut.graphML)
である。これでChiselのコンパイラを走らせると、GraphMLファイルが生成される。
sbt 'runMain freechips.rocketchip.unittest.Generator . freechips.rocketchip.unittest TestHarness freechips.rocketchip.unittest TLOriginalUnitTestConfig'
$ ls -1 | grep TLSimpleUnitTestConfig freechips.rocketchip.unittest.TLSimpleUnitTestConfig.0x400.0.regmap.json freechips.rocketchip.unittest.TLSimpleUnitTestConfig.0x400.1.regmap.json freechips.rocketchip.unittest.TLSimpleUnitTestConfig.0x400.2.regmap.json freechips.rocketchip.unittest.TLSimpleUnitTestConfig.anno.json freechips.rocketchip.unittest.TLSimpleUnitTestConfig.d freechips.rocketchip.unittest.TLSimpleUnitTestConfig.fir freechips.rocketchip.unittest.TLSimpleUnitTestConfig.plusArgs
これをWindows上に持ってきて、yzEditorというツールで開いた。
デフォルトだと何が何だか分からないので、Flowchartの形式に変換してみよう。