Upgrade to Pro — share decks privately, control downloads, hide ads and more …

16.09.25 Chisel+FIRRTL/自作HDLの試作

muojp
September 25, 2016

16.09.25 Chisel+FIRRTL/自作HDLの試作

RTLを語る会(12)で発表した、ChiselとFIRRTL、そしてFIRRTLベースの自作HDLを試作した話です。

muojp

September 25, 2016
Tweet

More Decks by muojp

Other Decks in Programming

Transcript

  1. ଞͷAlt-HDL(ࢀߟ) SFL(Structured Function description Language) ࢀߟ: https://ja.wikipedia.org/wiki/SFL Spinal HDL http://spinalhdl.github.io/SpinalDoc/

    ChiselʹΩϨͨਓ͕࡞Γ࢝ΊͨΠϯεύΠΞܥ ϚϧνΫϩοΫαϙʔτڧ͍ɺεςʔτϚγϯهड़ࢧԉ͋Γ (ࣗಈతʹ੾ͬͯ͘ΕΔΘ͚Ͱ͸ͳ͍)
  2. FIRRTLΛखॻ͖ͯ͠ΈΔ circuit Top : module HalfAdder : input clk :

    Clock input reset : UInt<1> input io_a : UInt<1> input io_b : UInt<1> output io_s : UInt<1> output io_c : UInt<1> skip io_s <= xor(io_a, io_b) io_c <= and(io_a, io_b) module Top : input clk : Clock input reset : UInt<1> inst halfAdder of HalfAdder halfAdder.io_a is invalid halfAdder.io_b is invalid halfAdder.clk <= clk halfAdder.reset <= reset
  3. class HalfAdder : Module { public HalfAdder() { var io

    = new { a = new UInt(isOut: false), b = new UInt(isOut: false), s = new UInt(isOut: true), c = new UInt(isOut: true) }; this.io = io; io.s.Assign(io.a + io.b); io.c.Assign(io.a ^ io.b); } } public class AdderGenerator { public static void Main() { FirrtlSharp.Generator.GenerateHDL(new HalfAdder()); } }
  4. ... module HalfAdder( input clk, input reset, input io_a, input

    io_b, output io_s, output io_c ); assign io_s = io_a & io_b; assign io_c = io_a ^ io_b; endmodule module TopHalfAdder( input clk, input reset ); wire halfadder_clk; wire halfadder_reset; ...