From 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 24 May 2018 01:37:55 -0700 Subject: systemc: Import tests from the Accellera systemc distribution. Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6 Reviewed-on: https://gem5-review.googlesource.com/10845 Reviewed-by: Giacomo Travaglini Maintainer: Gabe Black --- .../datatypes/misc/concat/test06/golden/test06.log | 22 +++++ .../datatypes/misc/concat/test06/test06.cpp | 99 ++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 src/systemc/tests/systemc/datatypes/misc/concat/test06/golden/test06.log create mode 100644 src/systemc/tests/systemc/datatypes/misc/concat/test06/test06.cpp (limited to 'src/systemc/tests/systemc/datatypes/misc/concat/test06') diff --git a/src/systemc/tests/systemc/datatypes/misc/concat/test06/golden/test06.log b/src/systemc/tests/systemc/datatypes/misc/concat/test06/golden/test06.log new file mode 100644 index 000000000..44a94d332 --- /dev/null +++ b/src/systemc/tests/systemc/datatypes/misc/concat/test06/golden/test06.log @@ -0,0 +1,22 @@ +SystemC Simulation +0b00 +0b1111111111111111111111111111111111111 + +0b001111111111111111111111111111 +0b111111111111111111111111111100 + +0b001111111111111111111111111111111111111 +0b111111111111111111111111111111111111100 + +0b0001111111111111111111111111111111111111 +0b0111111111111111111111111111111111111100 + +0b111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100 +0b001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + +0b0000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +0b1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000 + +0b1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000 +0b0000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + diff --git a/src/systemc/tests/systemc/datatypes/misc/concat/test06/test06.cpp b/src/systemc/tests/systemc/datatypes/misc/concat/test06/test06.cpp new file mode 100644 index 000000000..cd30aae64 --- /dev/null +++ b/src/systemc/tests/systemc/datatypes/misc/concat/test06/test06.cpp @@ -0,0 +1,99 @@ +/***************************************************************************** + + Licensed to Accellera Systems Initiative Inc. (Accellera) under one or + more contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright ownership. + Accellera licenses this file to you 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. + + *****************************************************************************/ + +/***************************************************************************** + + test06 -- test for high order bit concatenation bug. + + Original Author: + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +int sc_main(int argc, char** argv) { + sc_bigint<2> bi2; + sc_bigint<28> bi28; + sc_bigint<30> bi30; + sc_bigint<37> bi37; + sc_bigint<39> bi39; + sc_bigint<100> bi100; + sc_bigint<102> bi102; + sc_bigint<139> bi139; + sc_uint<39> bu39; + + bi2 = 0; + bi28 = -1; + bi37 = -1; + cout << bi2.to_string(SC_BIN) << endl + << bi37.to_string(SC_BIN) << endl; + cout << endl; + + bi30 = (bi2,bi28); + cout << bi30.to_string(SC_BIN) << endl; + bi30 = (bi28,bi2); + cout << bi30.to_string(SC_BIN) << endl; + cout << endl; + + bi39 = (bi2,bi37); + cout << bi39.to_string(SC_BIN) << endl; + bi39 = (bi37,bi2); + cout << bi39.to_string(SC_BIN) << endl; + cout << endl; + + bu39 = (bi2,bi37); + cout << bu39.to_string(SC_BIN) << endl; + bu39 = (bi37,bi2); + cout << bu39.to_string(SC_BIN) << endl; + cout << endl; + + bi100 = -1; + bi102 = (bi100,bi2); + cout << bi102.to_string(SC_BIN) << endl; + bi102 = (bi2,bi100); + cout << bi102.to_string(SC_BIN) << endl; + cout << endl; + + bi39 = 0; + bi139 = (bi39,bi100); + cout << bi139.to_string(SC_BIN) << endl; + bi139 = (bi100,bi39); + cout << bi139.to_string(SC_BIN) << endl; + cout << endl; + + bu39 = 0; + bi139 = (bi100,bu39); + cout << bi139.to_string(SC_BIN) << endl; + bi139 = (bu39,bi100); + cout << bi139.to_string(SC_BIN) << endl; + cout << endl; + + sc_start(1, SC_NS); + return 0; +} -- cgit v1.2.3