Sha256: a21a1a2b7c406965795aef44f66598a5f349101ec91dcdb4b5528f27db59afd4

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

# This file is the Ruby side of the bench.

require 'rubygems'
require 'ruby-vpi'

RubyVpi.init_bench :Counter, :rSpec do
  ##
  # This block is executed whenever Vpi::simulate is invoked.
  #
  # It simulates the design under test. This is typically done
  # by toggling the clock signal, as demonstrated below.
  ##

  ##
  # We are currently here (marked by the ! signs):
  #
  #    !
  #    !
  #    ! ____      ____      ____      ____
  # ___!/    \____/    \____/    \____/    \
  #    !
  #    !
  #
  ##

  Counter.clock.intVal = 1

  ##
  # After setting the clock signal to high, we are here:
  #
  #      !
  #      !
  #      !____      ____      ____      ____
  # ____/!    \____/    \____/    \____/    \
  #      !
  #      !
  #
  ##

  advance_time

  ##
  # After advancing the time, we are here:
  #
  #          !
  #          !
  #      ____!      ____      ____      ____
  # ____/    !\____/    \____/    \____/    \
  #          !
  #          !
  #
  ##

  Counter.clock.intVal = 0

  ##
  # After setting the clock signal to low, we are here:
  #
  #           !
  #           !
  #      ____ !     ____      ____      ____
  # ____/    \!____/    \____/    \____/    \
  #           !
  #           !
  #
  ##

  advance_time

  ##
  # After advancing the time, we are here:
  #
  #
  #               !
  #               !
  #      ____     ! ____      ____      ____
  # ____/    \____!/    \____/    \____/    \
  #               !
  #               !
  #
  ##

  ##
  # This process repeats when Vpi::simulate is invoked again.
  ##
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-vpi-14.0.0 samp/counter/counter_rspec_bench.rb
ruby-vpi-15.0.0 samp/counter/counter_rspec_bench.rb
ruby-vpi-15.0.1 samp/counter/counter_rspec_bench.rb
ruby-vpi-15.0.2 samp/counter/counter_rspec_bench.rb
ruby-vpi-16.0.0 samp/counter/counter_rspec_bench.rb
ruby-vpi-16.0.1 samp/counter/counter_rspec_bench.rb