From a67be0a0d5add356fd86aaa84c8bfb98f12ea1d6 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Fri, 18 Apr 2014 23:01:49 -0600 Subject: [PATCH] tests: add tests of the new "both" mode of edge.comp --- tests/edge/both-starting-high/expected | 10 +++++++++ tests/edge/both-starting-high/runstreamer | 13 ++++++++++++ tests/edge/both-starting-high/test.hal | 25 +++++++++++++++++++++++ tests/edge/both/expected | 10 +++++++++ tests/edge/both/runstreamer | 13 ++++++++++++ tests/edge/both/test.hal | 25 +++++++++++++++++++++++ 6 files changed, 96 insertions(+) create mode 100644 tests/edge/both-starting-high/expected create mode 100644 tests/edge/both-starting-high/runstreamer create mode 100644 tests/edge/both-starting-high/test.hal create mode 100644 tests/edge/both/expected create mode 100644 tests/edge/both/runstreamer create mode 100644 tests/edge/both/test.hal diff --git a/tests/edge/both-starting-high/expected b/tests/edge/both-starting-high/expected new file mode 100644 index 00000000000..e746a0b4001 --- /dev/null +++ b/tests/edge/both-starting-high/expected @@ -0,0 +1,10 @@ +1 0 1 +1 0 1 +1 0 1 +1 0 1 +0 1 0 +0 0 1 +1 1 0 +0 1 0 +0 0 1 +0 0 1 diff --git a/tests/edge/both-starting-high/runstreamer b/tests/edge/both-starting-high/runstreamer new file mode 100644 index 00000000000..eccdd6d68b2 --- /dev/null +++ b/tests/edge/both-starting-high/runstreamer @@ -0,0 +1,13 @@ +#!/bin/sh +halstreamer << EOF +1 +1 +1 +1 +0 +0 +1 +0 +0 +0 +EOF diff --git a/tests/edge/both-starting-high/test.hal b/tests/edge/both-starting-high/test.hal new file mode 100644 index 00000000000..54cc68f73d3 --- /dev/null +++ b/tests/edge/both-starting-high/test.hal @@ -0,0 +1,25 @@ +setexact_for_test_suite_only + +loadrt threads name1=fast period1=100000 +loadrt edge + +loadrt sampler cfg=bbb depth=500 +loadrt streamer cfg=b depth=500 + +net in streamer.0.pin.0 => sampler.0.pin.0 edge.0.in +net out edge.0.out => sampler.0.pin.1 +net out-invert edge.0.out-invert => sampler.0.pin.2 + +addf streamer.0 fast +addf edge.0 fast +addf sampler.0 fast + +# look for both falling and rising edges +setp edge.0.both True + +# keep the .out pin high for 25,000 ns, rounded up to the nearest thread period +setp edge.0.out-width-ns 25000 + +loadusr -w sh runstreamer +start +loadusr -w halsampler -n 10 diff --git a/tests/edge/both/expected b/tests/edge/both/expected new file mode 100644 index 00000000000..6f3be8df6b4 --- /dev/null +++ b/tests/edge/both/expected @@ -0,0 +1,10 @@ +0 0 1 +1 1 0 +1 0 1 +1 0 1 +0 1 0 +0 0 1 +1 1 0 +0 1 0 +0 0 1 +0 0 1 diff --git a/tests/edge/both/runstreamer b/tests/edge/both/runstreamer new file mode 100644 index 00000000000..8f49df8f2b8 --- /dev/null +++ b/tests/edge/both/runstreamer @@ -0,0 +1,13 @@ +#!/bin/sh +halstreamer << EOF +0 +1 +1 +1 +0 +0 +1 +0 +0 +0 +EOF diff --git a/tests/edge/both/test.hal b/tests/edge/both/test.hal new file mode 100644 index 00000000000..54cc68f73d3 --- /dev/null +++ b/tests/edge/both/test.hal @@ -0,0 +1,25 @@ +setexact_for_test_suite_only + +loadrt threads name1=fast period1=100000 +loadrt edge + +loadrt sampler cfg=bbb depth=500 +loadrt streamer cfg=b depth=500 + +net in streamer.0.pin.0 => sampler.0.pin.0 edge.0.in +net out edge.0.out => sampler.0.pin.1 +net out-invert edge.0.out-invert => sampler.0.pin.2 + +addf streamer.0 fast +addf edge.0 fast +addf sampler.0 fast + +# look for both falling and rising edges +setp edge.0.both True + +# keep the .out pin high for 25,000 ns, rounded up to the nearest thread period +setp edge.0.out-width-ns 25000 + +loadusr -w sh runstreamer +start +loadusr -w halsampler -n 10