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
そんなに違和感はない。
最終更新:2009年02月24日 01:59