Sha256: cf41d0e885517a9d3c50be6ec53fc294e58b049f3b1ba144d2973cad4990d0bc

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

# Testing HDLRuby unit test.
# require 'std/hruby_unit.rb' 

# Declare multiple simple dff-systems and their corresponding test.

3.times do |i|

    # A simple D-FF
    system:"dff#{i}" do
        input :clk, :rst, :d
        output :q, :qb

        qb <= ~q

        par(clk.posedge) { q <= d & ~rst }
    end

    # Code for testing it.
    Unit.system :"test_dff#{i}" do
        inner :clk, :rst, :d, :q, :qb

        send(:"dff#{i}",:dffI).(clk,rst,d,q,qb)

        test do
            clk <= 0
            rst <= 0
            d   <= 0
            !10.ns
            clk <= 1
            !10.ns
            clk <= 0
            rst <= 1
            !10.ns
            clk <= 1
            !10.ns
            clk <= 0
            rst <= 0
            !10.ns
            clk <= 1
            !10.ns
            clk <= 0
            d   <= 1
            !10.ns
            clk <= 1
            !10.ns
            clk <= 0
            d   <= 0
            !10.ns
            clk <= 1
            !10.ns
        end
    end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
HDLRuby-2.7.11 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.7.5 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.7.1 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.25 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.24 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.23 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.22 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.19 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.18 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.16 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.15 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.10 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.8 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.5 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.4 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.3 lib/HDLRuby/hdr_samples/dff_unit.rb
HDLRuby-2.6.2 lib/HDLRuby/hdr_samples/dff_unit.rb