From 50b5ce57d1b823a03725dd0aa2141f300c244bf1 Mon Sep 17 00:00:00 2001 From: azidar Date: Wed, 18 Feb 2015 17:20:11 -0800 Subject: Added more testing infrastructre, and Makefile to build firrtl --- test/lit.cfg | 4 ++++ test/unit/gcd.fir | 42 ++++++++++++++++++++++++++++++++++++++++++ test/unit/hello.fir | 2 ++ test/unit/simple.fir | 11 +++++++++++ 4 files changed, 59 insertions(+) create mode 100644 test/lit.cfg create mode 100644 test/unit/gcd.fir create mode 100644 test/unit/hello.fir create mode 100644 test/unit/simple.fir (limited to 'test') diff --git a/test/lit.cfg b/test/lit.cfg new file mode 100644 index 00000000..71928a43 --- /dev/null +++ b/test/lit.cfg @@ -0,0 +1,4 @@ +import lit.formats + +config.test_format = lit.formats.ShTest() +config.suffixes = ['.fir'] diff --git a/test/unit/gcd.fir b/test/unit/gcd.fir new file mode 100644 index 00000000..1d4d54af --- /dev/null +++ b/test/unit/gcd.fir @@ -0,0 +1,42 @@ +circuit top : + module subtracter : + input x : UInt + input y : UInt + output z : UInt + z := sub-mod(x, y) + module gcd : + input a : UInt(16) + input b : UInt(16) + input e : UInt(1) + output z : UInt(16) + output v : UInt(1) + reg x : UInt + reg y : UInt + x.init := UInt(0) + y.init := UInt(42) + when greater(x, y) : + inst s of subtracter + s.x := x + s.y := y + x := s.z + else : + inst s2 of subtracter + s2.x := x + s2.y := y + y := s2.z + when e : + x := a + y := b + v := equal(v, UInt(0)) + z := x + module top : + input a : UInt(16) + input b : UInt(16) + output z : UInt + inst i of gcd + i.a := a + i.b := b + i.e := UInt(1) + z := i.z + + diff --git a/test/unit/hello.fir b/test/unit/hello.fir new file mode 100644 index 00000000..4a905ab9 --- /dev/null +++ b/test/unit/hello.fir @@ -0,0 +1,2 @@ +# RUN: echo hello | FileCheck %s +# CHECK: hello diff --git a/test/unit/simple.fir b/test/unit/simple.fir new file mode 100644 index 00000000..01389604 --- /dev/null +++ b/test/unit/simple.fir @@ -0,0 +1,11 @@ +; RUN: firrtl %s | FileCheck %s + +circuit top : + module subtracter : + input x : UInt + input y : UInt + output z : UInt + z := sub-mod(x, y) +; CHECK: output z : UInt +; CHECK: port:z := sub-mod(port:x, port:y) + -- cgit v1.2.3