Ruby VPI




  • verilogとrubyを接続
  • ということは、基本リファレンスモデルなど、検証に使う

  • せっかくのオブジェクト指向言語なので、フリーなVMMという視点で見るのはどうか?
  • トランザクタとかそういう感じでGo?
  • チャネルも…?
  • ガベージコレクションをやらなくていいので、C/C++より楽そう。
  • 正規表現使えるのもうれしい
  • 別にCのVPI(→リファレンスモデル)が混在しててもいいのかな
  • テストシナリオの半自動生成も夢じゃないかも。

time         = S_vpi_time.new
time.type    = VpiSimTime
time.low     = 0
time.high    = 0
 
value        = S_vpi_value.new
value.format = VpiIntVal
 
alarm        = S_cb_data.new
alarm.reason = CbValueChange
alarm.obj    = Counter.count
alarm.time   = time
alarm.value  = value
alarm.index  = 0
 
vpi_register_cb( alarm ) do |info|
  time  = info.time.integer
  count = info.value.value.integer
  puts "hello from callback! time=#{time} count=#{count}"
end
ここらへんはCでVPIやるのと大差なさそう。単に記述スタイルが違うだけか。

always @(apple, banana, cherry, date) begin
  $display("Yum! Fruits are good for health!");
end
always do
  wait until [apple, banana, cherry, date].any? {|x| x.change?}
  puts "Yum! Fruits are good for health!"
end
シナリオの記述は柔軟性に富んだものが作れそうではある。

always @(posedge clock1 and negedge clock2) begin
  foo <= foo + 1;
  bar  = bar + 5; // treated as NON-blocking in prototype
end
always do
  wait until clock.posedge? and clock2.negedge?
  foo.intVal += 1
  bar.intVal += 5 # this is a NON-blocking assignment!
end
そんなに違和感はない。

  • ModelSim,Cverには対応している模様 - 名無しさん 2008-11-28 01:57:44
  • しかし本家以外の資料が少ないなぁ・・・ - 名無しさん 2008-11-28 12:28:44

Top > 言語 > verilog > Tips > Ruby VPI
link_pdfプラグインはご利用いただけなくなりました。























-

最終更新:2009年02月24日 01:59