From 62f026260633fe8ce70e4293e5a9c761d053b383 Mon Sep 17 00:00:00 2001
From: Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
Date: Fri, 29 Nov 2019 14:05:17 +0100
Subject: [PATCH] Fix licensing

---
 LICENSE.txt                   | 202 ++++++++++++++++++++
 src/Makefile                  |  19 +-
 src/backend.hpp               |  21 +-
 src/backend/distributed.cpp   |  21 +-
 src/backend/distributed.hpp   |  21 +-
 src/backend/simple.cpp        |  19 +-
 src/backend/simple.hpp        |  21 +-
 src/backend/tiled.cpp         |  21 +-
 src/backend/tiled.hpp         |  21 +-
 src/cifar10.cpp               |  21 +-
 src/core.hpp                  |  21 +-
 src/kernels/conv_relu_fwd.cpp |  21 +-
 src/kernels/conv_relu_fwd.hpp |  19 +-
 src/kernels/kernels.hpp       |  21 +-
 src/mmap.cpp                  |  21 +-
 src/mmap.hpp                  |  21 +-
 src/nst.cpp                   |  21 +-
 src/nst.hpp                   |  21 +-
 src/nst_model/fp32_mac.cpp    |  29 ++-
 src/nst_model/fp32_mac.hpp    |  29 ++-
 src/nst_model/nstV2Api.cpp    |  38 ++--
 src/nst_model/nstV2Api.hpp    |  21 +-
 src/param.hpp                 |  21 +-
 src/tensor-dma.hpp            |  19 +-
 src/tensor-io.hpp             |  21 +-
 src/tensor-padding.hpp        |  19 +-
 src/tensor.hpp                |  19 +-
 src/utils.hpp                 |  21 +-
 testbench/Makefile            |  19 +-
 testbench/genTestData.cpp     | 348 +++++++++++++++++-----------------
 30 files changed, 733 insertions(+), 424 deletions(-)
 create mode 100644 LICENSE.txt

diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/src/Makefile b/src/Makefile
index ec305f6..029d548 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,11 +1,16 @@
-# Copyright (C) 2017 ETH Zurich, University of Bologna
-# All rights reserved.
+# Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 #
-# This code is under development and not yet released to the public. Until it
-# is released, the code is under the copyright of ETH Zurich and the University
-# of Bologna, and may contain confidential and/or unpublished work. Any
-# reuse/redistribution is strictly forbidden without written permission from
-# ETH Zurich.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 # Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/backend.hpp b/src/backend.hpp
index 5ad17f0..16e20ac 100644
--- a/src/backend.hpp
+++ b/src/backend.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "tensor.hpp"
diff --git a/src/backend/distributed.cpp b/src/backend/distributed.cpp
index 692b213..cceb47f 100644
--- a/src/backend/distributed.cpp
+++ b/src/backend/distributed.cpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #include "../utils.hpp"
 #include "distributed.hpp"
diff --git a/src/backend/distributed.hpp b/src/backend/distributed.hpp
index 0bf9c08..d9f1f4b 100644
--- a/src/backend/distributed.hpp
+++ b/src/backend/distributed.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "../backend.hpp"
diff --git a/src/backend/simple.cpp b/src/backend/simple.cpp
index 6570514..b518817 100644
--- a/src/backend/simple.cpp
+++ b/src/backend/simple.cpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/backend/simple.hpp b/src/backend/simple.hpp
index 94f4bfb..9dd258d 100644
--- a/src/backend/simple.hpp
+++ b/src/backend/simple.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "../backend.hpp"
diff --git a/src/backend/tiled.cpp b/src/backend/tiled.cpp
index cfb947b..be955d1 100644
--- a/src/backend/tiled.cpp
+++ b/src/backend/tiled.cpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #include "../utils.hpp"
 #include "tiled.hpp"
diff --git a/src/backend/tiled.hpp b/src/backend/tiled.hpp
index 8459b01..e856133 100644
--- a/src/backend/tiled.hpp
+++ b/src/backend/tiled.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "../backend.hpp"
diff --git a/src/cifar10.cpp b/src/cifar10.cpp
index d8208db..479947e 100644
--- a/src/cifar10.cpp
+++ b/src/cifar10.cpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 
 #include "tensor.hpp"
diff --git a/src/core.hpp b/src/core.hpp
index 87fdbba..e0e6843 100644
--- a/src/core.hpp
+++ b/src/core.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include <algorithm>
diff --git a/src/kernels/conv_relu_fwd.cpp b/src/kernels/conv_relu_fwd.cpp
index 93ac3b7..f6b1a24 100644
--- a/src/kernels/conv_relu_fwd.cpp
+++ b/src/kernels/conv_relu_fwd.cpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
-//
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/kernels/conv_relu_fwd.hpp b/src/kernels/conv_relu_fwd.hpp
index 63c3869..fbaa3ad 100644
--- a/src/kernels/conv_relu_fwd.hpp
+++ b/src/kernels/conv_relu_fwd.hpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/kernels/kernels.hpp b/src/kernels/kernels.hpp
index e0de64e..77f821c 100644
--- a/src/kernels/kernels.hpp
+++ b/src/kernels/kernels.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "tensor.hpp"
diff --git a/src/mmap.cpp b/src/mmap.cpp
index 30d8c68..c65b5b2 100644
--- a/src/mmap.cpp
+++ b/src/mmap.cpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #include "mmap.hpp"
 #include <fcntl.h>
diff --git a/src/mmap.hpp b/src/mmap.hpp
index b1b3b7b..7fb7f59 100644
--- a/src/mmap.hpp
+++ b/src/mmap.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include <cstddef>
diff --git a/src/nst.cpp b/src/nst.cpp
index afe27d0..17bd837 100644
--- a/src/nst.cpp
+++ b/src/nst.cpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #include "nst.hpp"
 
diff --git a/src/nst.hpp b/src/nst.hpp
index 92df7fd..0b920f0 100644
--- a/src/nst.hpp
+++ b/src/nst.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #include "tensor.hpp"
 #include <thread>
diff --git a/src/nst_model/fp32_mac.cpp b/src/nst_model/fp32_mac.cpp
index 6394294..c1212c1 100644
--- a/src/nst_model/fp32_mac.cpp
+++ b/src/nst_model/fp32_mac.cpp
@@ -1,24 +1,19 @@
-///////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public.
-// Until it is released, the code is under the copyright of ETH Zurich and
-// the University of Bologna, and may contain confidential and/or unpublished
-// work. Any reuse/redistribution is strictly forbidden without written
-// permission from ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
 //
-// Bug fixes and contributions will eventually be released under the
-// SolderPad open hardware license in the context of the PULP platform
-// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
-// University of Bologna.
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-///////////////////////////////////////////////////////////////////////////////
-// Description:  This file is part of the NST Golden model, and implements
-// a bit true model of the FP Mac unit.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
-// Author: Michael Schaffner (schaffner@iis.ee.ethz.ch)
-///////////////////////////////////////////////////////////////////////////////
+// Michael Schaffner <schaffner@iis.ee.ethz.ch>
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 
 #include <stdio.h>
diff --git a/src/nst_model/fp32_mac.hpp b/src/nst_model/fp32_mac.hpp
index a1a0a10..dce20b2 100644
--- a/src/nst_model/fp32_mac.hpp
+++ b/src/nst_model/fp32_mac.hpp
@@ -1,24 +1,19 @@
-///////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public.
-// Until it is released, the code is under the copyright of ETH Zurich and
-// the University of Bologna, and may contain confidential and/or unpublished
-// work. Any reuse/redistribution is strictly forbidden without written
-// permission from ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
 //
-// Bug fixes and contributions will eventually be released under the
-// SolderPad open hardware license in the context of the PULP platform
-// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
-// University of Bologna.
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-///////////////////////////////////////////////////////////////////////////////
-// Description:  This file is part of the NST Golden model, and implements
-// a bit true model of the FP Mac unit.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
-// Author: Michael Schaffner (schaffner@iis.ee.ethz.ch)
-///////////////////////////////////////////////////////////////////////////////
+// Michael Schaffner <schaffner@iis.ee.ethz.ch>
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 
diff --git a/src/nst_model/nstV2Api.cpp b/src/nst_model/nstV2Api.cpp
index d264892..498efe1 100644
--- a/src/nst_model/nstV2Api.cpp
+++ b/src/nst_model/nstV2Api.cpp
@@ -1,23 +1,19 @@
-///////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public.
-// Until it is released, the code is under the copyright of ETH Zurich and
-// the University of Bologna, and may contain confidential and/or unpublished
-// work. Any reuse/redistribution is strictly forbidden without written
-// permission from ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
 //
-// Bug fixes and contributions will eventually be released under the
-// SolderPad open hardware license in the context of the PULP platform
-// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
-// University of Bologna.
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-///////////////////////////////////////////////////////////////////////////////
-// Description:  includes the implementation of the NST emulation functions
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
-// Author: Michael Schaffner (schaffner@iis.ee.ethz.ch)
-///////////////////////////////////////////////////////////////////////////////
+// Michael Schaffner <schaffner@iis.ee.ethz.ch>
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 
 #include <stdio.h>
@@ -217,7 +213,7 @@ nstV2Api::nstFuncModel ()
             op = new nstMaskMacOp(this);
             break;
         case C_NST_COPY_OP:
-            op = new nstCopyOp(this);    
+            op = new nstCopyOp(this);
             break;
         default:
             assert(0);
@@ -828,7 +824,7 @@ nstMaskMacOp::execute() {
         printf("fetching: opB = %f (0x%08X)\n",fp32ToFloat(*opB), *opB);
 #endif
     }
-    
+
     switch(nst->auxFunc) {
         case C_NST_THTST_AUX_CMP_EQ:
             tst = (fp32ToFloat(nst->aluState) == fp32ToFloat(*opB));
@@ -912,11 +908,11 @@ nstCopyOp::init() {
             nst->aluState = *(uint32_t *)nst->agu[nst->initSel];
         }
     }
-    
+
 #if NST_DEBUG_LEVEL > 1
     printf("init alu with %f (0x%08X)\n",fp32ToFloat(nst->aluState), nst->aluState);
     printf("op: NST_COPY");
-#endif    
+#endif
 
 }
 
@@ -925,7 +921,7 @@ nstCopyOp::execute() {
 
     if(nst->auxFunc & 0x1) {
         nst->aluState = *(uint32_t *)nst->agu[0];
-    
+
 #if NST_DEBUG_LEVEL > 1
         printf("fetching: aluState = %f (0x%08X)\n",fp32ToFloat(nst->aluState), nst->aluState);
 #endif
diff --git a/src/nst_model/nstV2Api.hpp b/src/nst_model/nstV2Api.hpp
index 6ce29ac..fd53c8d 100644
--- a/src/nst_model/nstV2Api.hpp
+++ b/src/nst_model/nstV2Api.hpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Michael Schaffner <schaffner@iis.ee.ethz.ch>
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
@@ -198,7 +203,7 @@ public:
     inline void
     setNstAddr(uint32_t nstAddr_) {
         nstAddr = (void*)(size_t)nstAddr_;
-    }  
+    }
 
 // functions for NST/CORE interaction on PULP
 #ifndef NST_EMULATION_ON
diff --git a/src/param.hpp b/src/param.hpp
index d80f140..89dc990 100644
--- a/src/param.hpp
+++ b/src/param.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "mmap.hpp"
diff --git a/src/tensor-dma.hpp b/src/tensor-dma.hpp
index d4b4959..5c7bf1b 100644
--- a/src/tensor-dma.hpp
+++ b/src/tensor-dma.hpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/tensor-io.hpp b/src/tensor-io.hpp
index d17932e..9e5592c 100644
--- a/src/tensor-io.hpp
+++ b/src/tensor-io.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "tensor.hpp"
diff --git a/src/tensor-padding.hpp b/src/tensor-padding.hpp
index 08a96b5..34cfc48 100644
--- a/src/tensor-padding.hpp
+++ b/src/tensor-padding.hpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/tensor.hpp b/src/tensor.hpp
index 942374c..5949258 100644
--- a/src/tensor.hpp
+++ b/src/tensor.hpp
@@ -1,11 +1,16 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
 // Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
diff --git a/src/utils.hpp b/src/utils.hpp
index a083464..045c07c 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -1,13 +1,18 @@
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-// This code is under development and not yet released to the public. Until it
-// is released, the code is under the copyright of ETH Zurich and the University
-// of Bologna, and may contain confidential and/or unpublished work. Any
-// reuse/redistribution is strictly forbidden without written permission from
-// ETH Zurich.
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #pragma once
 #include "core.hpp"
diff --git a/testbench/Makefile b/testbench/Makefile
index 9f5a247..1fb1b8a 100644
--- a/testbench/Makefile
+++ b/testbench/Makefile
@@ -1,11 +1,16 @@
-# Copyright (C) 2017 ETH Zurich, University of Bologna
-# All rights reserved.
+# Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 #
-# This code is under development and not yet released to the public. Until it
-# is released, the code is under the copyright of ETH Zurich and the University
-# of Bologna, and may contain confidential and/or unpublished work. Any
-# reuse/redistribution is strictly forbidden without written permission from
-# ETH Zurich.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
 # Michael Schaffner <schaffner@iis.ee.ethz.ch>
 # Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
diff --git a/testbench/genTestData.cpp b/testbench/genTestData.cpp
index b5b2e6b..aa2f385 100644
--- a/testbench/genTestData.cpp
+++ b/testbench/genTestData.cpp
@@ -1,23 +1,19 @@
-///////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 2017 ETH Zurich, University of Bologna
-// All rights reserved.
+// Copyright (C) 2017-2019 ETH Zurich, University of Bologna
 //
-// This code is under development and not yet released to the public.
-// Until it is released, the code is under the copyright of ETH Zurich and
-// the University of Bologna, and may contain confidential and/or unpublished 
-// work. Any reuse/redistribution is strictly forbidden without written
-// permission from ETH Zurich.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
 //
-// Bug fixes and contributions will eventually be released under the
-// SolderPad open hardware license in the context of the PULP platform
-// (http://www.pulp-platform.org), under the copyright of ETH Zurich and the
-// University of Bologna.
+//     http://www.apache.org/licenses/LICENSE-2.0
 //
-///////////////////////////////////////////////////////////////////////////////
-// Description: 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
 //
-// Author: Michael Schaffner (schaffner@iis.ee.ethz.ch)
-///////////////////////////////////////////////////////////////////////////////
+// Michael Schaffner <schaffner@iis.ee.ethz.ch>
+// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -26,7 +22,7 @@
 #include <math.h>
 #include <random>
 
-#define NST_EMULATION_ON 
+#define NST_EMULATION_ON
 
 #include "nstV2Api.hpp"
 
@@ -52,16 +48,16 @@
 #define ENABLE_COPY_TEST1
 
 /////////////////////////////
-// 
+//
 /////////////////////////////
 
-void 
-writeMemDump(const char *     fileName, 
+void
+writeMemDump(const char *     fileName,
              const uint32_t * array) {
     FILE * fid = fopen(fileName,"w");
     if(fid == NULL) {
          throw("error opening file\n");
-    } 
+    }
     for(uint32_t k = 0; k< C_TCDM_MEMSIZE; k++) {
         fprintf(fid,"0x%08x 0x%08x\n", k<<2, array[k]);
     }
@@ -71,9 +67,9 @@ writeMemDump(const char *     fileName,
 
 int
 main(int argc, char ** argv) {
-    
+
     try {
-        
+
         // 2D/2D convolution example
         uint32_t * tcdm = new uint32_t[C_TCDM_MEMSIZE];
 
@@ -91,27 +87,27 @@ main(int argc, char ** argv) {
         uint32_t cnt;
         char * str1 = new char[300];
         char * str2 = new char[300];
-        
+
         cnt = 0;
-            
+
         //////////////////////////////////////////////////////////
         // fixed vector length tests
         //////////////////////////////////////////////////////////
 
         /////////////////////////////
         // 1D MAC reduction kernel
-        // variants 
+        // variants
         // with/without init,
         // with/without ReLu
         // addititive/subtractive accumulation
         /////////////////////////////
 
-#ifdef ENABLE_1D_MAC_TEST        
+#ifdef ENABLE_1D_MAC_TEST
 
         for(int k = 0; k < 8; k++) {
 
-            vectorLen1 = 100; 
-            
+            vectorLen1 = 100;
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm + vectorLen1;
@@ -120,24 +116,24 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             nst.stageLoopNest(1,1,1,
                               {vectorLen1,0U,0U,0U,0U},
                               {1,0,0,0,0,
                                1,0,0,0,0,
                                0,0,0,0,0});
 
-            nst.stageAguOffs(opA, 
-                             opB, 
+            nst.stageAguOffs(opA,
+                             opB,
                              res);
 
             nst.stageCmd(C_NST_MAC_OP,                     // opCode
@@ -146,37 +142,37 @@ main(int argc, char ** argv) {
                          C_NST_SET_CMD_IRQ,                // irqCfg
                          (0x1 & (k >> 2)));                // polarity
 
-            // dump nst job 
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"1D_reduction_NST_MAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
 
             // call golden model
             nst.issueCmd();
-            
+
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
         /////////////////////////////
         // 2D reduction kernels
-        // variants 
+        // variants
         // with/without init,
         // with/without ReLu
         // addititive/subtractive accumulation
         /////////////////////////////
 
-#ifdef ENABLE_2D_MAC_TEST        
+#ifdef ENABLE_2D_MAC_TEST
 
         for(int k = 0; k < 8; k++) {
 
-            vectorLen1 = 10; 
-            
+            vectorLen1 = 10;
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm + 10;
@@ -185,11 +181,11 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1*vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
@@ -208,8 +204,8 @@ main(int argc, char ** argv) {
                          (0x1 & (k >> 1)),                 // auxFunc
                          C_NST_SET_CMD_IRQ,                // irqCfg
                          (0x1 & (k >> 2)));                // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"2D_reduction_NST_MAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -220,27 +216,27 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
         /////////////////////////////
         // 3D reduction kernels with 2D strides (uses all loops)
-        // variants 
+        // variants
         // with/without init,
         // with/without ReLu
         // addititive/subtractive accumulation
         /////////////////////////////
 
-#ifdef ENABLE_3D_MAC_TEST  
+#ifdef ENABLE_3D_MAC_TEST
         for(int k = 0; k < 8; k++) {
 
             // generate two 20x20 tiles with 10 channels
-            vectorLen1 = 10*20*20; 
+            vectorLen1 = 10*20*20;
             // a 3D convolution with 2D stride will then generate a 10x10 output
-            
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm + vectorLen1;
@@ -249,11 +245,11 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
@@ -272,8 +268,8 @@ main(int argc, char ** argv) {
                          (0x1 & (k >> 1)),                 // auxFunc
                          C_NST_SET_CMD_IRQ,                // irqCfg
                          (0x1 & (k >> 2)));                // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"3D_reduction_2D_stride_NST_MAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -284,9 +280,9 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
@@ -297,12 +293,12 @@ main(int argc, char ** argv) {
         // addition/subtraction
         /////////////////////////////
 
-#ifdef ENABLE_VADDSUB_TEST        
+#ifdef ENABLE_VADDSUB_TEST
 
         for(int k = 0; k < 4; k++) {
 
-            vectorLen1 = 100; 
-            
+            vectorLen1 = 100;
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm + vectorLen1;
@@ -311,11 +307,11 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
@@ -326,7 +322,7 @@ main(int argc, char ** argv) {
                                {1,0,0,0,0,
                                 1,0,0,0,0,
                                 1,0,0,0,0});
-            
+
             nst.stageAguOffs(opA, opB, res);
 
             nst.stageCmd(C_NST_VADDSUB_OP,      // opCode
@@ -334,8 +330,8 @@ main(int argc, char ** argv) {
                          (0x1 & k),             // auxFunc
                          C_NST_SET_CMD_IRQ,     // irqCfg
                          (0x1 & (k >> 1)));     // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"1D_vector_C_NST_VADDSUB_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -346,9 +342,9 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
@@ -358,12 +354,12 @@ main(int argc, char ** argv) {
         // addition/subtraction
         /////////////////////////////
 
-#ifdef ENABLE_VMULT_TEST        
+#ifdef ENABLE_VMULT_TEST
 
         for(int k = 0; k < 4; k++) {
 
-            vectorLen1 = 100; 
-            
+            vectorLen1 = 100;
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm + vectorLen1;
@@ -372,11 +368,11 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
@@ -395,8 +391,8 @@ main(int argc, char ** argv) {
                          (0x1 & k),  // auxFunc
                          C_NST_SET_CMD_IRQ, // irqCfg
                          (0x1 & (k >> 1))); // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"1D_vector_C_NST_VMULT_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -407,23 +403,23 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }        
+            cnt++;
+        }
 #endif
 
         /////////////////////////////
         // outer product
         /////////////////////////////
 
-#ifdef ENABLE_OUTERP_TEST        
+#ifdef ENABLE_OUTERP_TEST
 
         for(int k = 0; k < 4; k++) {
 
             // 20x20 outerproduct
-            vectorLen1 = 20; 
-            
+            vectorLen1 = 20;
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm +   vectorLen1*vectorLen1+10;
@@ -432,8 +428,8 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));    
-                *(opB+n) = floatTofp32(dist(re));    
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
             // dump memroy initialization
@@ -453,8 +449,8 @@ main(int argc, char ** argv) {
                          (0x1 & (k>>1)),       // auxFunc
                          C_NST_SET_CMD_IRQ,    // irqCfg
                          (0x1 & k));           // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"outer_product_C_NST_OUTERP_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -465,25 +461,25 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }    
+            cnt++;
+        }
 #endif
 
         /////////////////////////////
         // 1D MAXMIN reduction kernel
-        // variants 
+        // variants
         // with/without init,
         // with/without ReLu
         // addititive/subtractive accumulation
         /////////////////////////////
 
-#ifdef ENABLE_MAXMIN_TEST              
+#ifdef ENABLE_MAXMIN_TEST
         for(int k = 0; k < 4; k++) {
 
-            vectorLen1 = 100; 
-            
+            vectorLen1 = 100;
+
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
 
             opA = tcdm + vectorLen1;
@@ -492,11 +488,11 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
+                *(opB+n) = floatTofp32(dist(re));
             }
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
@@ -515,8 +511,8 @@ main(int argc, char ** argv) {
                          (0x1 & k),         // auxFunc
                          C_NST_SET_CMD_IRQ, // irqCfg
                          (0x1 & (k >> 1))); // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"1D_reduction_NST_MAXMIN_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -527,23 +523,23 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
         /////////////////////////////
-        // test/thresholding 
-        // variants 
+        // test/thresholding
+        // variants
         /////////////////////////////
 
-#ifdef ENABLE_THTST_TEST  
+#ifdef ENABLE_THTST_TEST
 
         for(int k = 0; k < 32; k++) {
 
             // loop over 10 vectors of length 100
-            vectorLen1 = 100*10; 
+            vectorLen1 = 100*10;
             // produces 10*100 output values
 
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
@@ -554,18 +550,18 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opB+n) = floatTofp32(dist(re));        
+                *(opB+n) = floatTofp32(dist(re));
             }
-            
+
             for (uint32_t n = 0; n < 10; ++n) {
-                *(opA+n) = floatTofp32(dist(re));        
+                *(opA+n) = floatTofp32(dist(re));
             }
 
             // for equality tests
-            *(opB+2) = floatTofp32(0.0); 
-            *(opA+1) = *(opB+15); 
+            *(opB+2) = floatTofp32(0.0);
+            *(opA+1) = *(opB+15);
 
-            *(res+0) = floatTofp32(dist(re));  
+            *(res+0) = floatTofp32(dist(re));
 
             // dump memroy initialization
             sprintf(str1,"../stimuli/ini%d.txt", cnt);
@@ -584,8 +580,8 @@ main(int argc, char ** argv) {
                          (0x7 & (k >> 1)),  // auxFunc
                          C_NST_SET_CMD_IRQ, // irqCfg
                          (0x1 & (k >> 4))); // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"vector_mask_NST_THTST_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -596,22 +592,22 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
         /////////////////////////////
         // masking
-        // variants 
+        // variants
         /////////////////////////////
 
-#ifdef ENABLE_MASK0_TEST  
+#ifdef ENABLE_MASK0_TEST
         for(int k = 0; k < 8; k++) {
 
             // loop over 10 vectors of length 100
-            vectorLen1 = 100*10; 
+            vectorLen1 = 100*10;
             // produces 10*100 output values
 
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
@@ -622,8 +618,8 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opB+n) = floatTofp32(dist(re));        
-                *(opA+n) = floatTofp32(dist(re));        
+                *(opB+n) = floatTofp32(dist(re));
+                *(opA+n) = floatTofp32(dist(re));
             }
 
             // dump memroy initialization
@@ -643,8 +639,8 @@ main(int argc, char ** argv) {
                          (0x3 & k),            // auxFunc
                          C_NST_SET_CMD_IRQ,    // irqCfg
                          (0x1 & (k >> 2)));    // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"vector_mask_NST_MASKMAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -655,23 +651,23 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
+            cnt++;
         }
 #endif
 
         /////////////////////////////
         // masking
-        // variants 
+        // variants
         // with internal counters
         /////////////////////////////
 
-#ifdef ENABLE_MASK1_TEST  
+#ifdef ENABLE_MASK1_TEST
         for(int k = 0; k < 2; k++) {
 
             // loop over 10 vectors of length 100
-            vectorLen1 = 100*10; 
+            vectorLen1 = 100*10;
             // produces 10*100 output values
 
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
@@ -682,11 +678,11 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));    
+                *(opA+n) = floatTofp32(dist(re));
             }
 
             for (uint32_t n = 0; n < 10; ++n) {
-                *(opB+n) = fmax(round(50.0*dist(re)+49.0),0.0f);  
+                *(opB+n) = fmax(round(50.0*dist(re)+49.0),0.0f);
             }
 
             // dump memroy initialization
@@ -706,8 +702,8 @@ main(int argc, char ** argv) {
                          C_NST_MASK_AUX_CMP_CNT, // auxFunc
                          C_NST_SET_CMD_IRQ,      // irqCfg
                          (0x1 & k));             // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"internal_counter_NST_MASKMAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -718,25 +714,25 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }        
+            cnt++;
+        }
 #endif
 
         /////////////////////////////
         // masking
-        // variants 
+        // variants
         // with internal counters
         /////////////////////////////
 
-#ifdef ENABLE_MASKMAC0_TEST  
+#ifdef ENABLE_MASKMAC0_TEST
         for(int k = 0; k < 8; k++) {
 
             // 10 vectors of length 100, stored at the res position
             // each vector has an associated vector with nonzero entries
             // and an offset in opA to be added to the argmax position
-            vectorLen1 = 100; 
+            vectorLen1 = 100;
             vectorLen2 = 10;
             // produces 10*100 output values
 
@@ -748,16 +744,16 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1*vectorLen2; ++n) {
-                *(res+n) = floatTofp32(dist(re));    
+                *(res+n) = floatTofp32(dist(re));
             }
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen2; ++n) {
-                *(opA+n) = floatTofp32(dist(re));    
+                *(opA+n) = floatTofp32(dist(re));
             }
             // generate Argmax indices
             for (uint32_t n = 0; n < vectorLen1*vectorLen2; ++n) {
-                *(opB+n) = floatTofp32(1.0 * (dist(re) >= 0.0));  
+                *(opB+n) = floatTofp32(1.0 * (dist(re) >= 0.0));
             }
 
             // dump memroy initialization
@@ -777,8 +773,8 @@ main(int argc, char ** argv) {
                          (0x3 & k),            // auxFunc
                          C_NST_SET_CMD_IRQ,    // irqCfg
                          (0x1 & (k >> 2)));    // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"internal_counter_NST_MASKMAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -789,25 +785,25 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }        
+            cnt++;
+        }
 #endif
 
         /////////////////////////////
         // masking
-        // variants 
+        // variants
         // with internal counters
         /////////////////////////////
 
-#ifdef ENABLE_MASKMAC1_TEST  
+#ifdef ENABLE_MASKMAC1_TEST
         for(int k = 0; k < 2; k++) {
 
             // 10 vectors of length 100, stored at the res position
-            // each vector has an associated argmax position in opB, 
+            // each vector has an associated argmax position in opB,
             // and an offset in opA to be added to the argmax position
-            vectorLen1 = 100; 
+            vectorLen1 = 100;
             vectorLen2 = 10;
             // produces 10*100 output values
 
@@ -819,16 +815,16 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1*vectorLen2; ++n) {
-                *(res+n) = floatTofp32(dist(re));    
+                *(res+n) = floatTofp32(dist(re));
             }
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen2; ++n) {
-                *(opA+n) = floatTofp32(dist(re));    
+                *(opA+n) = floatTofp32(dist(re));
             }
             // generate Argmax indices
             for (uint32_t n = 0; n < vectorLen2; ++n) {
-                *(opB+n) = fmax(round(vectorLen1/2 * dist(re) + vectorLen1/2 - 1),0.0f);  
+                *(opB+n) = fmax(round(vectorLen1/2 * dist(re) + vectorLen1/2 - 1),0.0f);
             }
 
             // dump memroy initialization
@@ -848,8 +844,8 @@ main(int argc, char ** argv) {
                          C_NST_MASK_AUX_CMP_CNT, // auxFunc:
                          C_NST_SET_CMD_IRQ,      // irqCfg
                          (0x1 & k));             // polarity
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"internal_counter_NST_MASKMAC_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -860,20 +856,20 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }        
+            cnt++;
+        }
 #endif
         /////////////////////////////
         // copy variant with init cycle
         /////////////////////////////
 
-#ifdef ENABLE_COPY_TEST0  
+#ifdef ENABLE_COPY_TEST0
         for(int k = 0; k < 2; k++) {
 
             // replicate 100 values from opA (100 vector) to res (10x100 matrix)
-            vectorLen1 = 100; 
+            vectorLen1 = 100;
             vectorLen2 = 10;
 
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
@@ -884,7 +880,7 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1; ++n) {
-                *(opA+n) = floatTofp32(dist(re));    
+                *(opA+n) = floatTofp32(dist(re));
             }
 
             // dump memroy initialization
@@ -904,8 +900,8 @@ main(int argc, char ** argv) {
                          C_NST_COPY_AUX_REPL,    // auxFunc: use init cycle to replicate this value
                          C_NST_SET_CMD_IRQ,      // irqCfg
                          C_NST_POS_POLARITY);    // polarity (unused here)
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"replicate_NST_COPY_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -916,21 +912,21 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }        
+            cnt++;
+        }
 #endif
 
         /////////////////////////////
         // copy variant with vector
         /////////////////////////////
 
-#ifdef ENABLE_COPY_TEST1  
+#ifdef ENABLE_COPY_TEST1
         for(int k = 0; k < 1; k++) {
 
             // copy 100x10 matrix from opA to res
-            vectorLen1 = 100; 
+            vectorLen1 = 100;
             vectorLen2 = 10;
 
             memset(tcdm, 0x55, sizeof(uint32_t)*C_TCDM_MEMSIZE);
@@ -941,7 +937,7 @@ main(int argc, char ** argv) {
 
             // generate some random data
             for (uint32_t n = 0; n < vectorLen1*vectorLen2; ++n) {
-                *(opA+n) = floatTofp32(dist(re));    
+                *(opA+n) = floatTofp32(dist(re));
             }
 
             // dump memroy initialization
@@ -961,8 +957,8 @@ main(int argc, char ** argv) {
                          C_NST_COPY_AUX_VECT,    // auxFunc: use init cycle to replicate this value
                          C_NST_SET_CMD_IRQ,      // irqCfg
                          C_NST_POS_POLARITY);    // polarity (unused here)
-            
-            // dump nst job 
+
+            // dump nst job
             sprintf(str1,"../stimuli/job%d.txt", cnt);
             sprintf(str2,"vector_NST_COPY_OP_%d",k);
             nst.writeJobDump(str1, str2, tcdm);
@@ -973,10 +969,10 @@ main(int argc, char ** argv) {
             // dump expected memory state
             sprintf(str1,"../stimuli/exp%d.txt", cnt);
             writeMemDump(str1, tcdm);
-            
+
             printf("generating job %u: %s\n", cnt, str2);
-            cnt++;   
-        }        
+            cnt++;
+        }
 #endif
 
 
-- 
GitLab