diff options
Diffstat (limited to 'src/systemc/tests/systemc/misc/stars')
158 files changed, 9638 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/stars/star102573/COMPILE b/src/systemc/tests/systemc/misc/stars/star102573/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102573/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star102573/for_nest.h b/src/systemc/tests/systemc/misc/stars/star102573/for_nest.h new file mode 100644 index 000000000..aa5ee10b8 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102573/for_nest.h @@ -0,0 +1,70 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + for_nest.h -- + + Original Author: Preeti Panda, Janssen, Synopsys, Inc., 2000-08-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +SC_MODULE( for_nest ) +{ + SC_HAS_PROCESS( for_nest ); + + sc_in_clk clk; + + const sc_signal<bool>& reset; + const sc_signal<bool>& in_valid; + const sc_signal<int>& in_value; + sc_signal<bool>& out_valid; + sc_signal<int>& result; + + for_nest( + sc_module_name NAME, // referense name + sc_clock& CLOCK, // clock + const sc_signal<bool>& RESET, + const sc_signal<bool>& IN_VALID, + const sc_signal<int>& IN_VALUE, + sc_signal<bool>& OUT_VALID, + sc_signal<int>& RESULT + ) + : clk (CLOCK), // connection definition + reset (RESET), + in_valid (IN_VALID), + in_value (IN_VALUE), + out_valid (OUT_VALID), + result (RESULT) + { + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,true); + }; + void entry (); +}; diff --git a/src/systemc/tests/systemc/misc/stars/star102573/star102573.cpp b/src/systemc/tests/systemc/misc/stars/star102573/star102573.cpp new file mode 100644 index 000000000..60385dc6f --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102573/star102573.cpp @@ -0,0 +1,96 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star102573.cpp -- + + Original Author: Preeti Panda, Synopsys, Inc., 2000-08-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "for_nest.h" + +#define max 5 +#define max1 4 +#define max2 3 +#define max3 2 + +void for_nest::entry() +{ + + sc_signed tmp2(2); + sc_signed tmp4(4); + sc_signed tmp8(8); + sc_signed tmp6(6); + + int i, j, inp_tmp; + + result.write(0); + out_valid.write(false); + wait(); + + main_loop:while(1) { + + while (in_valid.read()==false) wait(); + out_valid.write(true); + wait(); + /* unrolled loop inside rolled loop */ + loop1:for (i=1; i<=max; i++) { + tmp2 = in_value.read(); + inp_tmp = tmp2.to_int() + i ; + loop2:for (j=1; j<=max1; j++) + inp_tmp = inp_tmp - tmp2.to_int() ; + result.write(inp_tmp); + wait(); + }; + out_valid.write(false); + wait(); + out_valid.write(true); + wait(); + + inp_tmp = in_value.read(); + wait(); + /* unrolled loop inside unrolled loop */ + loop3:for (i=1; i<=max2; i++) { + inp_tmp += i ; + loop4:for (j=1; j<=max3; j++) { + inp_tmp -= j ; + } + }; + result.write(inp_tmp); + out_valid.write(false); + wait(); + out_valid.write(true); + wait(); + + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star102574/COMPILE b/src/systemc/tests/systemc/misc/stars/star102574/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102574/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star102574/star102574.cpp b/src/systemc/tests/systemc/misc/stars/star102574/star102574.cpp new file mode 100644 index 000000000..337ebde5b --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102574/star102574.cpp @@ -0,0 +1,120 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star102574.cpp -- + + Original Author: Preeti Panda, Synopsys, Inc., 2000-08-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "while_fsm.h" + +#define max 10 + +void while_fsm::entry() +{ + + int i, inp_tmp; + + // reset_loop + if (reset.read()==true) { + result.write(0); + out_valid.write(false); + wait(); + } else wait(); + + //---------- + // main loop + //---------- + while(1) { + + // read inputs + while (in_valid.read()==false) wait(); + + // execution of for loop + out_valid.write(true); + i=1; + wait(); + while (i<=max) { + inp_tmp = in_value.read(); + result.write(inp_tmp); + i++; + wait(); + }; + out_valid.write(false); + wait(); + + // execution of for loop with continues + out_valid.write(true); + i=0; + wait(); + do { + i++; + inp_tmp = in_value.read(); + if (i==8) { + wait(); + continue; + } else if (in_value.read()<5 && i!=1) { + wait(); + continue; + } else { + result.write(inp_tmp); + wait(); + } + } while (i<=max); + out_valid.write(false); + wait(); + wait(3); + + // for loop with break + out_valid.write(true); + i=0; + wait(); + do { + i++; + inp_tmp = in_value.read(); + if (inp_tmp==7) { + wait(); + break; + } else { + result.write(inp_tmp); + wait(); + }; + } while (i<=max); + out_valid.write(false); + wait(); + + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/stars/star102574/while_fsm.h b/src/systemc/tests/systemc/misc/stars/star102574/while_fsm.h new file mode 100644 index 000000000..477b99652 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102574/while_fsm.h @@ -0,0 +1,71 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + while_fsm.h -- + + Original Author: Preeti Panda, Synopsys, Inc., 2000-08-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +SC_MODULE( while_fsm ) +{ + SC_HAS_PROCESS( while_fsm ); + + sc_in_clk clk; + + const sc_signal<bool>& reset; + const sc_signal<bool>& in_valid; + const sc_signal<int>& in_value; + sc_signal<bool>& out_valid; + sc_signal<int>& result; + + while_fsm( + sc_module_name NAME, // referense name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal<bool>& IN_VALID, + const sc_signal<int>& IN_VALUE, + sc_signal<bool>& OUT_VALID, + sc_signal<int>& RESULT + ) + : + reset (RESET), + in_valid (IN_VALID), + in_value (IN_VALUE), + out_valid (OUT_VALID), + result (RESULT) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,true); + }; + void entry (); +}; diff --git a/src/systemc/tests/systemc/misc/stars/star103601-2/COMPILE b/src/systemc/tests/systemc/misc/stars/star103601-2/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103601-2/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star103601-2/star103601-2.cpp b/src/systemc/tests/systemc/misc/stars/star103601-2/star103601-2.cpp new file mode 100644 index 000000000..96da4bac9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103601-2/star103601-2.cpp @@ -0,0 +1,79 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star103601-2.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "test.h" + +void test::reset_loop() { + sc_uint<8> tmp, inp, caseexpr; + + wait(); + + done = 0; + dato = 0; + tmp = 0; + + wait(); + operational_loop: while(1 != 0) { + inp = dati.read(); + wait(); + inner : while(1 != 0) { + dato = tmp; + wait(); + + caseexpr = inp; + if(caseexpr == 1) { + tmp = 1; + } else if((caseexpr == 2) | (caseexpr == 3)) { + tmp = 2; + } else if(caseexpr != 4) { + tmp = 5; + break; + } else { + tmp = 4; + } + inp = inp + 1; + } + wait(); + done_loop : while(1) { + dato = tmp; + done = 1; + wait(); + } + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star103601-2/test.h b/src/systemc/tests/systemc/misc/stars/star103601-2/test.h new file mode 100644 index 000000000..da42797a3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103601-2/test.h @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +struct test : sc_module { + + sc_in<bool> reset; + sc_in_clk clk; + sc_in<sc_uint<8> > dati; + sc_out<sc_uint<8> > dato; + sc_out<bool> done; + + SC_HAS_PROCESS( test ); + + test (const char *NAME) : sc_module(NAME) { + SC_CTHREAD( reset_loop, clk.pos() ); + reset_signal_is(reset,true); + end_module(); + } + + void reset_loop(); +}; + diff --git a/src/systemc/tests/systemc/misc/stars/star103765/COMPILE b/src/systemc/tests/systemc/misc/stars/star103765/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103765/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star103765/star103765.cpp b/src/systemc/tests/systemc/misc/stars/star103765/star103765.cpp new file mode 100644 index 000000000..3dd3cc70e --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103765/star103765.cpp @@ -0,0 +1,76 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star103765.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "test.h" + +void test::reset_loop() { + sc_uint<8> tmp; + unsigned int i, j; + + wait(); + + done = 0; + dato = 0; + tmp = 0; + + wait(); + operational_loop: while(1 != 0) { + wait(); + + block1 : for(i = 0; i < 1; i++) { + tmp = tmp + 1; + dato = tmp; + wait(); + + tmp = tmp + 1; + if(tmp < 5) { + break; + } else { + continue; + } + tmp = tmp + 1; // should never get here + } + wait(); + done_loop : while(1) { + dato = tmp; + done = 1; + wait(); + } + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star103765/test.h b/src/systemc/tests/systemc/misc/stars/star103765/test.h new file mode 100644 index 000000000..da42797a3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103765/test.h @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +struct test : sc_module { + + sc_in<bool> reset; + sc_in_clk clk; + sc_in<sc_uint<8> > dati; + sc_out<sc_uint<8> > dato; + sc_out<bool> done; + + SC_HAS_PROCESS( test ); + + test (const char *NAME) : sc_module(NAME) { + SC_CTHREAD( reset_loop, clk.pos() ); + reset_signal_is(reset,true); + end_module(); + } + + void reset_loop(); +}; + diff --git a/src/systemc/tests/systemc/misc/stars/star103832/COMPILE b/src/systemc/tests/systemc/misc/stars/star103832/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103832/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star103832/star103832.cpp b/src/systemc/tests/systemc/misc/stars/star103832/star103832.cpp new file mode 100644 index 000000000..fd0d49e19 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star103832/star103832.cpp @@ -0,0 +1,98 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star103832.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> + +struct test : sc_module { + + sc_in<bool> reset; + sc_in_clk clk; + sc_in<sc_uint<8> > dati; + sc_out<sc_uint<8> > dato; + sc_out<bool> done; + + SC_HAS_PROCESS( test ); + + test (const char *NAME) : sc_module(NAME) { + SC_CTHREAD( reset_loop, clk.pos() ); + reset_signal_is(reset,true); + end_module(); + } + + void tc_mult_8x8(sc_uint<8> A, sc_uint<8> B, sc_uint<16>& Y); + void reset_loop(); +}; + +void test::tc_mult_8x8(sc_uint<8> A, sc_uint<8> B, sc_uint<16>& Z) { + sc_uint<8> MantA; + sc_uint<16> MantC; + sc_uint<1> SignC, SignA, SignB; + sc_uint<8> MantB; + if (A == 0 || B == 0) { + Z = 0; + } else { + SignA = A[7]; + SignB = B[7]; + MantA = SignA ? sc_uint<8>(0 - A) : A; + MantB = SignB ? sc_uint<8>(0 - B) : B; + MantC = MantA * MantB; + SignC = SignA ^ SignB; + MantC = SignC ? sc_uint<16>(0 - MantC) : MantC; + Z = (SignC, MantC.range(14,0)); + } +} + +void test::reset_loop() { + sc_uint<16> tmp; + sc_uint<8> inp; + done = 0; + dato = 0; + tmp = 0; + wait(); + operational_loop : while (1 != 0) { + inp = dati.read(); + wait(); + tc_mult_8x8( inp, -2, tmp); + wait(); + done_loop: while (1) { + dato = tmp; + done = 1; + wait(); + } + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star104726/COMPILE b/src/systemc/tests/systemc/misc/stars/star104726/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star104726/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star104726/global.h b/src/systemc/tests/systemc/misc/stars/star104726/global.h new file mode 100644 index 000000000..3baed2740 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star104726/global.h @@ -0,0 +1,239 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + global.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#ifndef GLOBALH +#define GLOBALH + + +// #include <iostream.h> +#include <stdio.h> + +#define MAXBUFLEN 64 + +// cos constants, factor 512 +#define c1d4 362L +#define c1d8 473L +#define c3d8 196L +#define c1d16 502L +#define c3d16 426L +#define c5d16 284L +#define c7d16 100L + +// correct digits +#define MSCALE(expr) (COEFF)((expr)>>9) + +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef unsigned long DWORD; + +typedef BYTE BLOCK[8][8]; +typedef BYTE COMPRESSED[MAXBUFLEN]; +typedef WORD MATRIX64x12[64]; + +// type of the coefficient arrays +typedef short COEFF; + +// typedefs for huffman tables +typedef struct { + BYTE size; + WORD code; +} HUFFMTBL_ENTRY; + + +struct Block { + BYTE b[8][8]; + + Block(); + Block(BLOCK *); + Block(const Block&); + void operator=(const Block&); + int operator==(const Block&) const; + + BYTE get(int x, int y) const; + void put(int x, int y, BYTE val); + BLOCK* get_ptr() const; +}; + +struct Compressed { + BYTE c[MAXBUFLEN]; + + Compressed(); + Compressed(const Compressed&); + void operator=(const Compressed&); + int operator==(const Compressed&) const; + + void clear(); + BYTE get(int x) const; + void put(int x, BYTE val); +}; + +struct Matrix64x12 { + WORD m[64]; + + Matrix64x12(); + Matrix64x12(const Matrix64x12&); + void operator=(const Matrix64x12&); + int operator==(const Matrix64x12&) const; + + WORD get(int x) const; + void put(int x, WORD val); +}; + +struct Coeff8 { + COEFF c[8]; + + Coeff8(); + Coeff8(const Coeff8&); + void operator=(const Coeff8&); + int operator==(const Coeff8&) const; + + COEFF get(int x) const; + void put(int x, COEFF val); +}; + +struct Coeff8x8 { + COEFF c[8][8]; + + Coeff8x8(); + Coeff8x8(const Coeff8x8&); + void operator=(const Coeff8x8&); + int operator==(const Coeff8x8&) const; + + COEFF get(int x, int y) const; + void put(int x, int y, COEFF val); +}; + +inline +void +sc_trace( sc_trace_file*, const Coeff8x8&, const std::string& ) +{ + // NOT IMPLEMENTED +} + + +// quantization table 8-bit unsigned integer +static const unsigned char coeff_quant[8][8] = { // v is row + { 16, 11, 10, 16, 24, 40, 51, 61}, + { 12, 12, 14, 19, 26, 58, 60, 55}, + { 14, 13, 16, 24, 40, 57, 69, 56}, + { 14, 17, 22, 29, 51, 87, 80, 82}, + { 18, 22, 37, 56, 68, 109, 103, 77}, + { 24, 35, 55, 64, 81, 104, 113, 92}, + { 99, 64, 78, 87, 103, 121, 120, 101}, + { 72, 92, 95, 98, 112, 100, 103, 99} +}; + + +// table of Huffman DC coefficients +static const HUFFMTBL_ENTRY huffm_dc[12] = { + { 2, 0X0000 }, { 3, 0X0002 }, { 3, 0X0003 }, { 3, 0X0004 }, + { 3, 0X0005 }, { 3, 0X0006 }, { 4, 0X000E }, { 5, 0X001E }, + { 6, 0X003E }, { 7, 0X007E }, { 8, 0X00FE }, { 9, 0X01FE } +}; + + +// table of Huffman AC coefficients +static const HUFFMTBL_ENTRY huffm_ac[256] = { + { 4, 0x000a }, { 2, 0x0000 }, { 2, 0x0001 }, { 3, 0x0004 }, + { 4, 0x000b }, { 5, 0x001a }, { 7, 0x0078 }, { 8, 0x00f8 }, + { 10, 0x03f6 }, { 16, 0xff82 }, { 16, 0xff83 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 4, 0x000c }, { 5, 0x001b }, { 7, 0x0079 }, + { 9, 0x01f6 }, { 11, 0x07f6 }, { 16, 0xff84 }, { 16, 0xff85 }, + { 16, 0xff86 }, { 16, 0xff87 }, { 16, 0xff88 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 5, 0x001c }, { 8, 0x00f9 }, { 10, 0x03f7 }, + { 12, 0x0ff4 }, { 16, 0xff89 }, { 16, 0xff8a }, { 16, 0xff8b }, + { 16, 0xff8c }, { 16, 0xff8d }, { 16, 0xff8e }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 6, 0x003a }, { 9, 0x01f7 }, { 12, 0x0ff5 }, + { 16, 0xff8f }, { 16, 0xff90 }, { 16, 0xff91 }, { 16, 0xff92 }, + { 16, 0xff93 }, { 16, 0xff94 }, { 16, 0xff95 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 6, 0x003b }, { 10, 0x03f8 }, { 16, 0xff96 }, + { 16, 0xff97 }, { 16, 0xff98 }, { 16, 0xff99 }, { 16, 0xff9a }, + { 16, 0xff9b }, { 16, 0xff9c }, { 16, 0xff9d }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 7, 0x007a }, { 11, 0x07f7 }, { 16, 0xff9e }, + { 16, 0xff9f }, { 16, 0xffa0 }, { 16, 0xffa1 }, { 16, 0xffa2 }, + { 16, 0xffa3 }, { 16, 0xffa4 }, { 16, 0xffa5 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 7, 0x007b }, { 12, 0x0ff6 }, { 16, 0xffa6 }, + { 16, 0xffa7 }, { 16, 0xffa8 }, { 16, 0xffa9 }, { 16, 0xffaa }, + { 16, 0xffab }, { 16, 0xffac }, { 16, 0xffad }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 8, 0x00fa }, { 12, 0x0ff7 }, { 16, 0xffae }, + { 16, 0xffaf }, { 16, 0xffb0 }, { 16, 0xffb1 }, { 16, 0xffb2 }, + { 16, 0xffb3 }, { 16, 0xffb4 }, { 16, 0xffb5 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 9, 0x01f8 }, { 15, 0x7fc0 }, { 16, 0xffb6 }, + { 16, 0xffb7 }, { 16, 0xffb8 }, { 16, 0xffb9 }, { 16, 0xffba }, + { 16, 0xffbb }, { 16, 0xffbc }, { 16, 0xffbd }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 9, 0x01f9 }, { 16, 0xffbe }, { 16, 0xffbf }, + { 16, 0xffc0 }, { 16, 0xffc1 }, { 16, 0xffc2 }, { 16, 0xffc3 }, + { 16, 0xffc4 }, { 16, 0xffc5 }, { 16, 0xffc6 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 9, 0x01fa }, { 16, 0xffc7 }, { 16, 0xffc8 }, + { 16, 0xffc9 }, { 16, 0xffca }, { 16, 0xffcb }, { 16, 0xffcc }, + { 16, 0xffcd }, { 16, 0xffce }, { 16, 0xffcf }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 10, 0x03f9 }, { 16, 0xffd0 }, { 16, 0xffd1 }, + { 16, 0xffd2 }, { 16, 0xffd3 }, { 16, 0xffd4 }, { 16, 0xffd5 }, + { 16, 0xffd6 }, { 16, 0xffd7 }, { 16, 0xffd8 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 10, 0x03fa }, { 16, 0xffd9 }, { 16, 0xffda }, + { 16, 0xffdb }, { 16, 0xffdc }, { 16, 0xffdd }, { 16, 0xffde }, + { 16, 0xffdf }, { 16, 0xffe0 }, { 16, 0xffe1 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 11, 0x07f8 }, { 16, 0xffe2 }, { 16, 0xffe3 }, + { 16, 0xffe4 }, { 16, 0xffe5 }, { 16, 0xffe6 }, { 16, 0xffe7 }, + { 16, 0xffe8 }, { 16, 0xffe9 }, { 16, 0xffea }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 16, 0xffeb }, { 16, 0xffec }, { 16, 0xffed }, + { 16, 0xffee }, { 16, 0xffef }, { 16, 0xfff0 }, { 16, 0xfff1 }, + { 16, 0xfff2 }, { 16, 0xfff3 }, { 16, 0xfff4 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 11, 0x07f9 }, { 16, 0xfff5 }, { 16, 0xfff6 }, { 16, 0xfff7 }, + { 16, 0xfff8 }, { 16, 0xfff9 }, { 16, 0xfffa }, { 16, 0xfffb }, + { 16, 0xfffc }, { 16, 0xfffd }, { 16, 0xfffe }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 } + }; + + +#endif + diff --git a/src/systemc/tests/systemc/misc/stars/star104726/quant.h b/src/systemc/tests/systemc/misc/stars/star104726/quant.h new file mode 100644 index 000000000..24e24da4b --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star104726/quant.h @@ -0,0 +1,66 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + quant.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#ifndef QUANTH +#define QUANTH + +#include <systemc.h> +#include "global.h" + +SC_MODULE(quant) { + + sc_in_clk clk; + + sc_in<Coeff8x8> data_in; + sc_in<bool> start; + sc_in<bool> data_ok; + + sc_out<Coeff8x8> data_out; + sc_out<bool> ready; + sc_out<bool> data_out_ready; + + void do_quant(); + + SC_CTOR(quant) { + SC_CTHREAD(do_quant,clk.pos()); + }; + +}; + + +#endif + diff --git a/src/systemc/tests/systemc/misc/stars/star104726/star104726.cpp b/src/systemc/tests/systemc/misc/stars/star104726/star104726.cpp new file mode 100644 index 000000000..043e230b6 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star104726/star104726.cpp @@ -0,0 +1,73 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star104726.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "quant.h" + + +void quant::do_quant() +{ + Coeff8x8 c; + Coeff8x8 fuv; + COEFF ff; + int u,v; + + while(true) { + + ready.write(true); + data_out_ready.write(false); + do { wait(); } while (start==false); + ready.write(false); + + c = data_in.read(); + + // quantization + for( v=0; v<8; v++ ) { + for( u=0; u<8; u++ ) { + ff = (c.get(v,u)<<1) / (COEFF)(coeff_quant[v][u]); + fuv.put(v,u,(ff<0 ? ff : ff+1) >> 1); + } + } + + data_out.write(fuv); + + data_out_ready.write(true); + do { wait(); } while (data_ok==false); + + } +} + + diff --git a/src/systemc/tests/systemc/misc/stars/star105234/golden/star105234.log b/src/systemc/tests/systemc/misc/stars/star105234/golden/star105234.log new file mode 100644 index 000000000..6d243dcc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star105234/golden/star105234.log @@ -0,0 +1 @@ +SystemC Simulation diff --git a/src/systemc/tests/systemc/misc/stars/star105234/star105234.cpp b/src/systemc/tests/systemc/misc/stars/star105234/star105234.cpp new file mode 100644 index 000000000..cb040b1a3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star105234/star105234.cpp @@ -0,0 +1,53 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star105234.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// the problem was in to_signed() method + +#include "systemc.h" + +int sc_main(int, char**) +{ + + sc_bv<3> b; + + b = "101"; + int x = b.to_int(); + + sc_assert(x==-3); + + return(0); +} diff --git a/src/systemc/tests/systemc/misc/stars/star106015/COMPILE b/src/systemc/tests/systemc/misc/stars/star106015/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star106015/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star106015/mem.h b/src/systemc/tests/systemc/misc/stars/star106015/mem.h new file mode 100644 index 000000000..ab5046899 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star106015/mem.h @@ -0,0 +1,57 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + mem.h -- + + Original Author: Stan Liao, Synopsys, Inc., 2000-07-11 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +struct memory : sc_module { + + sc_in_clk clk; + sc_in<sc_uint<8> > in_value1; + sc_in<bool> in_valid1; + sc_out<bool> out_valid1; + + SC_HAS_PROCESS( memory ); + + memory (const char *NAME) + : sc_module (NAME) + { + SC_CTHREAD( entry, clk.pos() ); + end_module(); + }; + + void entry (); + +}; + diff --git a/src/systemc/tests/systemc/misc/stars/star106015/star106015.cpp b/src/systemc/tests/systemc/misc/stars/star106015/star106015.cpp new file mode 100644 index 000000000..282aadc8b --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star106015/star106015.cpp @@ -0,0 +1,65 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star106015.cpp -- + + Original Author: Stan Liao, Synopsys, Inc., 2000-07-11 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "mem.h" + +void memory::entry(){ + + unsigned tmp1; + sc_uint<8> mem[128]; + sc_uint<8> mem2[128]; + + out_valid1.write(false); + wait(); + + while(1) { + while(in_valid1.read()==false) { + mem[1] = 1; + wait(); + } + wait(); + out_valid1.write(true); + wait(); + } + while(1) { + out_valid1.write(false); + } + while(1) { + out_valid1.write(false); + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star107460/golden/star107460.log b/src/systemc/tests/systemc/misc/stars/star107460/golden/star107460.log new file mode 100644 index 000000000..54eb6b23a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107460/golden/star107460.log @@ -0,0 +1,9 @@ +SystemC Simulation + +bv = 00000000 +lv = 000X0100 +Warning: (W207) sc_bv cannot contain values X and Z +In file: <removed by verify.pl> + +bv = 00010100 +lv = 000X0100 diff --git a/src/systemc/tests/systemc/misc/stars/star107460/star107460.cpp b/src/systemc/tests/systemc/misc/stars/star107460/star107460.cpp new file mode 100644 index 000000000..d204f21ef --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107460/star107460.cpp @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star107460.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// If one assigns a sc_lv vector containing X or Z to +// sc_bv the error message tells you that this is not +// possible, but doesn't tell you where(which variable +// at least) this happened. In a large program such a +// message is impossible to trace + +#include "systemc.h" + +int sc_main(int, char**) +{ + sc_lv<8> lv("00X0100"); + sc_bv<8> bv; + + cout << "\nbv = "<<bv <<"\nlv = "<<lv; + bv = lv; + cout << "\nbv = "<<bv <<"\nlv = "<<lv<<"\n"; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star107464/golden/test.log b/src/systemc/tests/systemc/misc/stars/star107464/golden/test.log new file mode 100644 index 000000000..688e4d767 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107464/golden/test.log @@ -0,0 +1,4 @@ +SystemC Simulation +1111111111111111111111111111111111111111 +-1 +4294967295 diff --git a/src/systemc/tests/systemc/misc/stars/star107464/test.cpp b/src/systemc/tests/systemc/misc/stars/star107464/test.cpp new file mode 100644 index 000000000..ec259885a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107464/test.cpp @@ -0,0 +1,49 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_bv<40> a( -1 ); + cout << a << endl; + cout << a.to_int() << endl; + cout << a.to_uint() << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star107468/golden/star107468.log b/src/systemc/tests/systemc/misc/stars/star107468/golden/star107468.log new file mode 100644 index 000000000..b80bc44e2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107468/golden/star107468.log @@ -0,0 +1,14 @@ +SystemC Simulation + +Info: (I804) /IEEE_Std_1666/deprecated: sc_bit is deprecated, use bool instead + +Warning: (W212) sc_logic value 'X' cannot be converted to bool +In file: <removed by verify.pl> + +Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about + IEEE 1666 deprecated features by placing this method call + as the first statement in your sc_main() function: + + sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", + sc_core::SC_DO_NOTHING ); + diff --git a/src/systemc/tests/systemc/misc/stars/star107468/star107468.cpp b/src/systemc/tests/systemc/misc/stars/star107468/star107468.cpp new file mode 100644 index 000000000..71d34afbd --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107468/star107468.cpp @@ -0,0 +1,53 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star107468.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// When I assign a sc_logic with value 'X' to sc_bit +// the error message is not very helpful. Especially it +// does not mention where this wrongful assignment +// happened. At least we should mention the variable +// name. + +#include "systemc.h" + +int sc_main(int, char**) +{ + sc_logic x('X'); + sc_bit a; + a = x.to_bool(); + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star107755/COMPILE b/src/systemc/tests/systemc/misc/stars/star107755/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107755/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star107755/regfile.h b/src/systemc/tests/systemc/misc/stars/star107755/regfile.h new file mode 100644 index 000000000..c92583df9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107755/regfile.h @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + regfile.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +struct test : sc_module { + + sc_in<bool> reset; + sc_in_clk clk; + sc_in<sc_lv<14> > dati; + sc_out<sc_lv<14> > dato; + sc_out<sc_logic> ready, done; + + SC_HAS_PROCESS( test ); + + test (const char *NAME) : sc_module(NAME) { + SC_CTHREAD( reset_loop, clk.pos() ); + reset_signal_is(reset,true); + end_module(); + } + + void reset_loop(); +}; + diff --git a/src/systemc/tests/systemc/misc/stars/star107755/star107755.cpp b/src/systemc/tests/systemc/misc/stars/star107755/star107755.cpp new file mode 100644 index 000000000..4511b1bc3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star107755/star107755.cpp @@ -0,0 +1,80 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star107755.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" +#include "regfile.h" + +void test::reset_loop() { + sc_uint<14> cell[2]; + sc_uint<14> cell1[2]; + + sc_uint<14> dat0, dat3; + sc_uint<14> out0, out3; + + dato.write(0); + dat0 = dat3 = out0 = out3 = 0; + ready.write(sc_logic('0')); + done.write(sc_logic('0')); + + wait(); + while (1) { + ready.write(sc_logic('1')); + wait(); + + ready.write(sc_logic('0')); + dat0 = dati.read(); + wait(); + + dat3 = dati.read(); + + cell[0] = dat0; + + cell1[1] = dat3; + + out0 = cell[0]; + out3 = cell1[1]; + + dato.write(out0); + done.write(sc_logic('1')); + wait(); + + dato.write(out3); + done.write(sc_logic('0')); + wait(); + + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star108117/COMPILE b/src/systemc/tests/systemc/misc/stars/star108117/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star108117/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star108117/bv_arith.h b/src/systemc/tests/systemc/misc/stars/star108117/bv_arith.h new file mode 100644 index 000000000..6e2900ef9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star108117/bv_arith.h @@ -0,0 +1,63 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + bv_arith.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + + + +/* ----- insert bv_arith_bv_arith_40.h ----- */ + +#include <systemc.h> + +SC_MODULE(bv_arith) { + + sc_out<sc_bigint<80> > XX; + sc_in_clk Clock; + sc_in<bool> Reset; + sc_in<bool> eg_enable; + sc_in<bool> eg_start; + sc_out<bool> eg_exitc; + + + void COMBI(); + + SC_CTOR(bv_arith) { + SC_METHOD(COMBI); + sensitive << eg_enable << eg_start; + + } +}; + diff --git a/src/systemc/tests/systemc/misc/stars/star108117/star108117.cpp b/src/systemc/tests/systemc/misc/stars/star108117/star108117.cpp new file mode 100644 index 000000000..9f4d03629 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star108117/star108117.cpp @@ -0,0 +1,59 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star108117.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "bv_arith.h" + + + + +/* ----- insert bv_arith_bv_arith_40.cc ----- */ + +#include <systemc.h> + + +void bv_arith::COMBI() +{ + + sc_bigint<80> XX_; + + { + /* ===== Default Ports to 0 ===== */ + + XX_ = sc_bigint<80> (0); + + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star108761/COMPILE b/src/systemc/tests/systemc/misc/stars/star108761/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star108761/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star108761/star108761.cpp b/src/systemc/tests/systemc/misc/stars/star108761/star108761.cpp new file mode 100644 index 000000000..929dab135 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star108761/star108761.cpp @@ -0,0 +1,1102 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star108761.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +SC_MODULE(test) { + sc_in_clk clk; + sc_in<bool> reset; + sc_in<sc_uint<10> > inp; + sc_out<sc_uint<10> > outp; + + SC_CTOR(test) { + SC_CTHREAD(entry, clk.pos()); + reset_signal_is(reset,true); + end_module(); + } + + void entry(); +}; + + +sc_uint<10> comp_mux(sc_uint<10> invar) { + sc_uint<10> outvar; + + if(invar == 0) { + outvar = 1023; + } else if(invar == 1) { + outvar = 1022; + } else if(invar == 2) { + outvar = 1021; + } else if(invar == 3) { + outvar = 1020; + } else if(invar == 4) { + outvar = 1019; + } else if(invar == 5) { + outvar = 1018; + } else if(invar == 6) { + outvar = 1017; + } else if(invar == 7) { + outvar = 1016; + } else if(invar == 8) { + outvar = 1015; + } else if(invar == 9) { + outvar = 1014; + } else if(invar == 10) { + outvar = 1013; + } else if(invar == 11) { + outvar = 1012; + } else if(invar == 12) { + outvar = 1011; + } else if(invar == 13) { + outvar = 1010; + } else if(invar == 14) { + outvar = 1009; + } else if(invar == 15) { + outvar = 1008; + } else if(invar == 16) { + outvar = 1007; + } else if(invar == 17) { + outvar = 1006; + } else if(invar == 18) { + outvar = 1005; + } else if(invar == 19) { + outvar = 1004; + } else if(invar == 20) { + outvar = 1003; + } else if(invar == 21) { + outvar = 1002; + } else if(invar == 22) { + outvar = 1001; + } else if(invar == 23) { + outvar = 1000; + } else if(invar == 24) { + outvar = 999; + } else if(invar == 25) { + outvar = 998; + } else if(invar == 26) { + outvar = 997; + } else if(invar == 27) { + outvar = 996; + } else if(invar == 28) { + outvar = 995; + } else if(invar == 29) { + outvar = 994; + } else if(invar == 30) { + outvar = 993; + } else if(invar == 31) { + outvar = 992; + } else if(invar == 32) { + outvar = 991; + } else if(invar == 33) { + outvar = 990; + } else if(invar == 34) { + outvar = 989; + } else if(invar == 35) { + outvar = 988; + } else if(invar == 36) { + outvar = 987; + } else if(invar == 37) { + outvar = 986; + } else if(invar == 38) { + outvar = 985; + } else if(invar == 39) { + outvar = 984; + } else if(invar == 40) { + outvar = 983; + } else if(invar == 41) { + outvar = 982; + } else if(invar == 42) { + outvar = 981; + } else if(invar == 43) { + outvar = 980; + } else if(invar == 44) { + outvar = 979; + } else if(invar == 45) { + outvar = 978; + } else if(invar == 46) { + outvar = 977; + } else if(invar == 47) { + outvar = 976; + } else if(invar == 48) { + outvar = 975; + } else if(invar == 49) { + outvar = 974; + } else if(invar == 50) { + outvar = 973; + } else if(invar == 51) { + outvar = 972; + } else if(invar == 52) { + outvar = 971; + } else if(invar == 53) { + outvar = 970; + } else if(invar == 54) { + outvar = 969; + } else if(invar == 55) { + outvar = 968; + } else if(invar == 56) { + outvar = 967; + } else if(invar == 57) { + outvar = 966; + } else if(invar == 58) { + outvar = 965; + } else if(invar == 59) { + outvar = 964; + } else if(invar == 60) { + outvar = 963; + } else if(invar == 61) { + outvar = 962; + } else if(invar == 62) { + outvar = 961; + } else if(invar == 63) { + outvar = 960; + } else if(invar == 64) { + outvar = 959; + } else if(invar == 65) { + outvar = 958; + } else if(invar == 66) { + outvar = 957; + } else if(invar == 67) { + outvar = 956; + } else if(invar == 68) { + outvar = 955; + } else if(invar == 69) { + outvar = 954; + } else if(invar == 70) { + outvar = 953; + } else if(invar == 71) { + outvar = 952; + } else if(invar == 72) { + outvar = 951; + } else if(invar == 73) { + outvar = 950; + } else if(invar == 74) { + outvar = 949; + } else if(invar == 75) { + outvar = 948; + } else if(invar == 76) { + outvar = 947; + } else if(invar == 77) { + outvar = 946; + } else if(invar == 78) { + outvar = 945; + } else if(invar == 79) { + outvar = 944; + } else if(invar == 80) { + outvar = 943; + } else if(invar == 81) { + outvar = 942; + } else if(invar == 82) { + outvar = 941; + } else if(invar == 83) { + outvar = 940; + } else if(invar == 84) { + outvar = 939; + } else if(invar == 85) { + outvar = 938; + } else if(invar == 86) { + outvar = 937; + } else if(invar == 87) { + outvar = 936; + } else if(invar == 88) { + outvar = 935; + } else if(invar == 89) { + outvar = 934; + } else if(invar == 90) { + outvar = 933; + } else if(invar == 91) { + outvar = 932; + } else if(invar == 92) { + outvar = 931; + } else if(invar == 93) { + outvar = 930; + } else if(invar == 94) { + outvar = 929; + } else if(invar == 95) { + outvar = 928; + } else if(invar == 96) { + outvar = 927; + } else if(invar == 97) { + outvar = 926; + } else if(invar == 98) { + outvar = 925; + } else if(invar == 99) { + outvar = 924; + } else if(invar == 100) { + outvar = 923; + } else if(invar == 101) { + outvar = 922; + } else if(invar == 102) { + outvar = 921; + } else if(invar == 103) { + outvar = 920; + } else if(invar == 104) { + outvar = 919; + } else if(invar == 105) { + outvar = 918; + } else if(invar == 106) { + outvar = 917; + } else if(invar == 107) { + outvar = 916; + } else if(invar == 108) { + outvar = 915; + } else if(invar == 109) { + outvar = 914; + } else if(invar == 110) { + outvar = 913; + } else if(invar == 111) { + outvar = 912; + } else if(invar == 112) { + outvar = 911; + } else if(invar == 113) { + outvar = 910; + } else if(invar == 114) { + outvar = 909; + } else if(invar == 115) { + outvar = 908; + } else if(invar == 116) { + outvar = 907; + } else if(invar == 117) { + outvar = 906; + } else if(invar == 118) { + outvar = 905; + } else if(invar == 119) { + outvar = 904; + } else if(invar == 120) { + outvar = 903; + } else if(invar == 121) { + outvar = 902; +#if !defined( _MSC_VER ) + // 'cl' compiler limit: blocks nested too deeply + } else if(invar == 122) { + outvar = 901; + } else if(invar == 123) { + outvar = 900; + } else if(invar == 124) { + outvar = 899; + } else if(invar == 125) { + outvar = 898; + } else if(invar == 126) { + outvar = 897; + } else if(invar == 127) { + outvar = 896; + } else if(invar == 128) { + outvar = 895; + } else if(invar == 129) { + outvar = 894; + } else if(invar == 130) { + outvar = 893; + } else if(invar == 131) { + outvar = 892; + } else if(invar == 132) { + outvar = 891; + } else if(invar == 133) { + outvar = 890; + } else if(invar == 134) { + outvar = 889; + } else if(invar == 135) { + outvar = 888; + } else if(invar == 136) { + outvar = 887; + } else if(invar == 137) { + outvar = 886; + } else if(invar == 138) { + outvar = 885; + } else if(invar == 139) { + outvar = 884; + } else if(invar == 140) { + outvar = 883; + } else if(invar == 141) { + outvar = 882; + } else if(invar == 142) { + outvar = 881; + } else if(invar == 143) { + outvar = 880; + } else if(invar == 144) { + outvar = 879; + } else if(invar == 145) { + outvar = 878; + } else if(invar == 146) { + outvar = 877; + } else if(invar == 147) { + outvar = 876; + } else if(invar == 148) { + outvar = 875; + } else if(invar == 149) { + outvar = 874; + } else if(invar == 150) { + outvar = 873; + } else if(invar == 151) { + outvar = 872; + } else if(invar == 152) { + outvar = 871; + } else if(invar == 153) { + outvar = 870; + } else if(invar == 154) { + outvar = 869; + } else if(invar == 155) { + outvar = 868; + } else if(invar == 156) { + outvar = 867; + } else if(invar == 157) { + outvar = 866; + } else if(invar == 158) { + outvar = 865; + } else if(invar == 159) { + outvar = 864; + } else if(invar == 160) { + outvar = 863; + } else if(invar == 161) { + outvar = 862; + } else if(invar == 162) { + outvar = 861; + } else if(invar == 163) { + outvar = 860; + } else if(invar == 164) { + outvar = 859; + } else if(invar == 165) { + outvar = 858; + } else if(invar == 166) { + outvar = 857; + } else if(invar == 167) { + outvar = 856; + } else if(invar == 168) { + outvar = 855; + } else if(invar == 169) { + outvar = 854; + } else if(invar == 170) { + outvar = 853; + } else if(invar == 171) { + outvar = 852; + } else if(invar == 172) { + outvar = 851; + } else if(invar == 173) { + outvar = 850; + } else if(invar == 174) { + outvar = 849; + } else if(invar == 175) { + outvar = 848; + } else if(invar == 176) { + outvar = 847; + } else if(invar == 177) { + outvar = 846; + } else if(invar == 178) { + outvar = 845; + } else if(invar == 179) { + outvar = 844; + } else if(invar == 180) { + outvar = 843; + } else if(invar == 181) { + outvar = 842; + } else if(invar == 182) { + outvar = 841; + } else if(invar == 183) { + outvar = 840; + } else if(invar == 184) { + outvar = 839; + } else if(invar == 185) { + outvar = 838; + } else if(invar == 186) { + outvar = 837; + } else if(invar == 187) { + outvar = 836; + } else if(invar == 188) { + outvar = 835; + } else if(invar == 189) { + outvar = 834; + } else if(invar == 190) { + outvar = 833; + } else if(invar == 191) { + outvar = 832; + } else if(invar == 192) { + outvar = 831; + } else if(invar == 193) { + outvar = 830; + } else if(invar == 194) { + outvar = 829; + } else if(invar == 195) { + outvar = 828; + } else if(invar == 196) { + outvar = 827; + } else if(invar == 197) { + outvar = 826; + } else if(invar == 198) { + outvar = 825; + } else if(invar == 199) { + outvar = 824; + } else if(invar == 200) { + outvar = 823; + } else if(invar == 201) { + outvar = 822; + } else if(invar == 202) { + outvar = 821; + } else if(invar == 203) { + outvar = 820; + } else if(invar == 204) { + outvar = 819; + } else if(invar == 205) { + outvar = 818; + } else if(invar == 206) { + outvar = 817; + } else if(invar == 207) { + outvar = 816; + } else if(invar == 208) { + outvar = 815; + } else if(invar == 209) { + outvar = 814; + } else if(invar == 210) { + outvar = 813; + } else if(invar == 211) { + outvar = 812; + } else if(invar == 212) { + outvar = 811; + } else if(invar == 213) { + outvar = 810; + } else if(invar == 214) { + outvar = 809; + } else if(invar == 215) { + outvar = 808; + } else if(invar == 216) { + outvar = 807; + } else if(invar == 217) { + outvar = 806; + } else if(invar == 218) { + outvar = 805; + } else if(invar == 219) { + outvar = 804; + } else if(invar == 220) { + outvar = 803; + } else if(invar == 221) { + outvar = 802; + } else if(invar == 222) { + outvar = 801; + } else if(invar == 223) { + outvar = 800; + } else if(invar == 224) { + outvar = 799; + } else if(invar == 225) { + outvar = 798; + } else if(invar == 226) { + outvar = 797; + } else if(invar == 227) { + outvar = 796; + } else if(invar == 228) { + outvar = 795; + } else if(invar == 229) { + outvar = 794; + } else if(invar == 230) { + outvar = 793; + } else if(invar == 231) { + outvar = 792; + } else if(invar == 232) { + outvar = 791; + } else if(invar == 233) { + outvar = 790; + } else if(invar == 234) { + outvar = 789; + } else if(invar == 235) { + outvar = 788; + } else if(invar == 236) { + outvar = 787; + } else if(invar == 237) { + outvar = 786; + } else if(invar == 238) { + outvar = 785; + } else if(invar == 239) { + outvar = 784; + } else if(invar == 240) { + outvar = 783; + } else if(invar == 241) { + outvar = 782; + } else if(invar == 242) { + outvar = 781; + } else if(invar == 243) { + outvar = 780; + } else if(invar == 244) { + outvar = 779; + } else if(invar == 245) { + outvar = 778; + } else if(invar == 246) { + outvar = 777; + } else if(invar == 247) { + outvar = 776; + } else if(invar == 248) { + outvar = 775; + } else if(invar == 249) { + outvar = 774; + } else if(invar == 250) { + outvar = 773; + } else if(invar == 251) { + outvar = 772; + } else if(invar == 252) { + outvar = 771; + } else if(invar == 253) { + outvar = 770; + } else if(invar == 254) { + outvar = 769; + } else if(invar == 255) { + outvar = 768; + } else if(invar == 256) { + outvar = 767; + } else if(invar == 257) { + outvar = 766; + } else if(invar == 258) { + outvar = 765; + } else if(invar == 259) { + outvar = 764; + } else if(invar == 260) { + outvar = 763; + } else if(invar == 261) { + outvar = 762; + } else if(invar == 262) { + outvar = 761; + } else if(invar == 263) { + outvar = 760; + } else if(invar == 264) { + outvar = 759; + } else if(invar == 265) { + outvar = 758; + } else if(invar == 266) { + outvar = 757; + } else if(invar == 267) { + outvar = 756; + } else if(invar == 268) { + outvar = 755; + } else if(invar == 269) { + outvar = 754; + } else if(invar == 270) { + outvar = 753; + } else if(invar == 271) { + outvar = 752; + } else if(invar == 272) { + outvar = 751; + } else if(invar == 273) { + outvar = 750; + } else if(invar == 274) { + outvar = 749; + } else if(invar == 275) { + outvar = 748; + } else if(invar == 276) { + outvar = 747; + } else if(invar == 277) { + outvar = 746; + } else if(invar == 278) { + outvar = 745; + } else if(invar == 279) { + outvar = 744; + } else if(invar == 280) { + outvar = 743; + } else if(invar == 281) { + outvar = 742; + } else if(invar == 282) { + outvar = 741; + } else if(invar == 283) { + outvar = 740; + } else if(invar == 284) { + outvar = 739; + } else if(invar == 285) { + outvar = 738; + } else if(invar == 286) { + outvar = 737; + } else if(invar == 287) { + outvar = 736; + } else if(invar == 288) { + outvar = 735; + } else if(invar == 289) { + outvar = 734; + } else if(invar == 290) { + outvar = 733; + } else if(invar == 291) { + outvar = 732; + } else if(invar == 292) { + outvar = 731; + } else if(invar == 293) { + outvar = 730; + } else if(invar == 294) { + outvar = 729; + } else if(invar == 295) { + outvar = 728; + } else if(invar == 296) { + outvar = 727; + } else if(invar == 297) { + outvar = 726; + } else if(invar == 298) { + outvar = 725; + } else if(invar == 299) { + outvar = 724; + } else if(invar == 300) { + outvar = 723; + } else if(invar == 301) { + outvar = 722; + } else if(invar == 302) { + outvar = 721; + } else if(invar == 303) { + outvar = 720; + } else if(invar == 304) { + outvar = 719; + } else if(invar == 305) { + outvar = 718; + } else if(invar == 306) { + outvar = 717; + } else if(invar == 307) { + outvar = 716; + } else if(invar == 308) { + outvar = 715; + } else if(invar == 309) { + outvar = 714; + } else if(invar == 310) { + outvar = 713; + } else if(invar == 311) { + outvar = 712; + } else if(invar == 312) { + outvar = 711; + } else if(invar == 313) { + outvar = 710; + } else if(invar == 314) { + outvar = 709; + } else if(invar == 315) { + outvar = 708; + } else if(invar == 316) { + outvar = 707; + } else if(invar == 317) { + outvar = 706; + } else if(invar == 318) { + outvar = 705; + } else if(invar == 319) { + outvar = 704; + } else if(invar == 320) { + outvar = 703; + } else if(invar == 321) { + outvar = 702; + } else if(invar == 322) { + outvar = 701; + } else if(invar == 323) { + outvar = 700; + } else if(invar == 324) { + outvar = 699; + } else if(invar == 325) { + outvar = 698; + } else if(invar == 326) { + outvar = 697; + } else if(invar == 327) { + outvar = 696; + } else if(invar == 328) { + outvar = 695; + } else if(invar == 329) { + outvar = 694; + } else if(invar == 330) { + outvar = 693; + } else if(invar == 331) { + outvar = 692; + } else if(invar == 332) { + outvar = 691; + } else if(invar == 333) { + outvar = 690; + } else if(invar == 334) { + outvar = 689; + } else if(invar == 335) { + outvar = 688; + } else if(invar == 336) { + outvar = 687; + } else if(invar == 337) { + outvar = 686; + } else if(invar == 338) { + outvar = 685; + } else if(invar == 339) { + outvar = 684; + } else if(invar == 340) { + outvar = 683; + } else if(invar == 341) { + outvar = 682; + } else if(invar == 342) { + outvar = 681; + } else if(invar == 343) { + outvar = 680; + } else if(invar == 344) { + outvar = 679; + } else if(invar == 345) { + outvar = 678; + } else if(invar == 346) { + outvar = 677; + } else if(invar == 347) { + outvar = 676; + } else if(invar == 348) { + outvar = 675; + } else if(invar == 349) { + outvar = 674; + } else if(invar == 350) { + outvar = 673; + } else if(invar == 351) { + outvar = 672; + } else if(invar == 352) { + outvar = 671; + } else if(invar == 353) { + outvar = 670; + } else if(invar == 354) { + outvar = 669; + } else if(invar == 355) { + outvar = 668; + } else if(invar == 356) { + outvar = 667; + } else if(invar == 357) { + outvar = 666; + } else if(invar == 358) { + outvar = 665; + } else if(invar == 359) { + outvar = 664; + } else if(invar == 360) { + outvar = 663; + } else if(invar == 361) { + outvar = 662; + } else if(invar == 362) { + outvar = 661; + } else if(invar == 363) { + outvar = 660; + } else if(invar == 364) { + outvar = 659; + } else if(invar == 365) { + outvar = 658; + } else if(invar == 366) { + outvar = 657; + } else if(invar == 367) { + outvar = 656; + } else if(invar == 368) { + outvar = 655; + } else if(invar == 369) { + outvar = 654; + } else if(invar == 370) { + outvar = 653; + } else if(invar == 371) { + outvar = 652; + } else if(invar == 372) { + outvar = 651; + } else if(invar == 373) { + outvar = 650; + } else if(invar == 374) { + outvar = 649; + } else if(invar == 375) { + outvar = 648; + } else if(invar == 376) { + outvar = 647; + } else if(invar == 377) { + outvar = 646; + } else if(invar == 378) { + outvar = 645; + } else if(invar == 379) { + outvar = 644; + } else if(invar == 380) { + outvar = 643; + } else if(invar == 381) { + outvar = 642; + } else if(invar == 382) { + outvar = 641; + } else if(invar == 383) { + outvar = 640; + } else if(invar == 384) { + outvar = 639; + } else if(invar == 385) { + outvar = 638; + } else if(invar == 386) { + outvar = 637; + } else if(invar == 387) { + outvar = 636; + } else if(invar == 388) { + outvar = 635; + } else if(invar == 389) { + outvar = 634; + } else if(invar == 390) { + outvar = 633; + } else if(invar == 391) { + outvar = 632; + } else if(invar == 392) { + outvar = 631; + } else if(invar == 393) { + outvar = 630; + } else if(invar == 394) { + outvar = 629; + } else if(invar == 395) { + outvar = 628; + } else if(invar == 396) { + outvar = 627; + } else if(invar == 397) { + outvar = 626; + } else if(invar == 398) { + outvar = 625; + } else if(invar == 399) { + outvar = 624; + } else if(invar == 400) { + outvar = 623; + } else if(invar == 401) { + outvar = 622; + } else if(invar == 402) { + outvar = 621; + } else if(invar == 403) { + outvar = 620; + } else if(invar == 404) { + outvar = 619; + } else if(invar == 405) { + outvar = 618; + } else if(invar == 406) { + outvar = 617; + } else if(invar == 407) { + outvar = 616; + } else if(invar == 408) { + outvar = 615; + } else if(invar == 409) { + outvar = 614; + } else if(invar == 410) { + outvar = 613; + } else if(invar == 411) { + outvar = 612; + } else if(invar == 412) { + outvar = 611; + } else if(invar == 413) { + outvar = 610; + } else if(invar == 414) { + outvar = 609; + } else if(invar == 415) { + outvar = 608; + } else if(invar == 416) { + outvar = 607; + } else if(invar == 417) { + outvar = 606; + } else if(invar == 418) { + outvar = 605; + } else if(invar == 419) { + outvar = 604; + } else if(invar == 420) { + outvar = 603; + } else if(invar == 421) { + outvar = 602; + } else if(invar == 422) { + outvar = 601; + } else if(invar == 423) { + outvar = 600; + } else if(invar == 424) { + outvar = 599; + } else if(invar == 425) { + outvar = 598; + } else if(invar == 426) { + outvar = 597; + } else if(invar == 427) { + outvar = 596; + } else if(invar == 428) { + outvar = 595; + } else if(invar == 429) { + outvar = 594; + } else if(invar == 430) { + outvar = 593; + } else if(invar == 431) { + outvar = 592; + } else if(invar == 432) { + outvar = 591; + } else if(invar == 433) { + outvar = 590; + } else if(invar == 434) { + outvar = 589; + } else if(invar == 435) { + outvar = 588; + } else if(invar == 436) { + outvar = 587; + } else if(invar == 437) { + outvar = 586; + } else if(invar == 438) { + outvar = 585; + } else if(invar == 439) { + outvar = 584; + } else if(invar == 440) { + outvar = 583; + } else if(invar == 441) { + outvar = 582; + } else if(invar == 442) { + outvar = 581; + } else if(invar == 443) { + outvar = 580; + } else if(invar == 444) { + outvar = 579; + } else if(invar == 445) { + outvar = 578; + } else if(invar == 446) { + outvar = 577; + } else if(invar == 447) { + outvar = 576; + } else if(invar == 448) { + outvar = 575; + } else if(invar == 449) { + outvar = 574; + } else if(invar == 450) { + outvar = 573; + } else if(invar == 451) { + outvar = 572; + } else if(invar == 452) { + outvar = 571; + } else if(invar == 453) { + outvar = 570; + } else if(invar == 454) { + outvar = 569; + } else if(invar == 455) { + outvar = 568; + } else if(invar == 456) { + outvar = 567; + } else if(invar == 457) { + outvar = 566; + } else if(invar == 458) { + outvar = 565; + } else if(invar == 459) { + outvar = 564; + } else if(invar == 460) { + outvar = 563; + } else if(invar == 461) { + outvar = 562; + } else if(invar == 462) { + outvar = 561; + } else if(invar == 463) { + outvar = 560; + } else if(invar == 464) { + outvar = 559; + } else if(invar == 465) { + outvar = 558; + } else if(invar == 466) { + outvar = 557; + } else if(invar == 467) { + outvar = 556; + } else if(invar == 468) { + outvar = 555; + } else if(invar == 469) { + outvar = 554; + } else if(invar == 470) { + outvar = 553; + } else if(invar == 471) { + outvar = 552; + } else if(invar == 472) { + outvar = 551; + } else if(invar == 473) { + outvar = 550; + } else if(invar == 474) { + outvar = 549; + } else if(invar == 475) { + outvar = 548; + } else if(invar == 476) { + outvar = 547; + } else if(invar == 477) { + outvar = 546; + } else if(invar == 478) { + outvar = 545; + } else if(invar == 479) { + outvar = 544; + } else if(invar == 480) { + outvar = 543; + } else if(invar == 481) { + outvar = 542; + } else if(invar == 482) { + outvar = 541; + } else if(invar == 483) { + outvar = 540; + } else if(invar == 484) { + outvar = 539; + } else if(invar == 485) { + outvar = 538; + } else if(invar == 486) { + outvar = 537; + } else if(invar == 487) { + outvar = 536; + } else if(invar == 488) { + outvar = 535; + } else if(invar == 489) { + outvar = 534; + } else if(invar == 490) { + outvar = 533; + } else if(invar == 491) { + outvar = 532; + } else if(invar == 492) { + outvar = 531; + } else if(invar == 493) { + outvar = 530; + } else if(invar == 494) { + outvar = 529; + } else if(invar == 495) { + outvar = 528; + } else if(invar == 496) { + outvar = 527; + } else if(invar == 497) { + outvar = 526; + } else if(invar == 498) { + outvar = 525; + } else if(invar == 499) { + outvar = 524; + } else if(invar == 500) { + outvar = 523; + } else if(invar == 501) { + outvar = 522; + } else if(invar == 502) { + outvar = 521; + } else if(invar == 503) { + outvar = 520; + } else if(invar == 504) { + outvar = 519; + } else if(invar == 505) { + outvar = 518; + } else if(invar == 506) { + outvar = 517; + } else if(invar == 507) { + outvar = 516; + } else if(invar == 508) { + outvar = 515; + } else if(invar == 509) { + outvar = 514; + } else if(invar == 510) { + outvar = 513; + } else if(invar == 511) { + outvar = 512; + } else if(invar == 512) { + outvar = 511; +#endif + } return outvar; +} + +void test::entry() { + sc_uint<10> tmp; + + outp.write(0); + wait(); + while(1) { + // tmp = comp_mux(inp); + tmp = comp_mux(inp.read()); + outp.write(tmp); + wait(); + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star109180/COMPILE b/src/systemc/tests/systemc/misc/stars/star109180/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109180/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star109180/regfile.h b/src/systemc/tests/systemc/misc/stars/star109180/regfile.h new file mode 100644 index 000000000..c92583df9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109180/regfile.h @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + regfile.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +struct test : sc_module { + + sc_in<bool> reset; + sc_in_clk clk; + sc_in<sc_lv<14> > dati; + sc_out<sc_lv<14> > dato; + sc_out<sc_logic> ready, done; + + SC_HAS_PROCESS( test ); + + test (const char *NAME) : sc_module(NAME) { + SC_CTHREAD( reset_loop, clk.pos() ); + reset_signal_is(reset,true); + end_module(); + } + + void reset_loop(); +}; + diff --git a/src/systemc/tests/systemc/misc/stars/star109180/star109180.cpp b/src/systemc/tests/systemc/misc/stars/star109180/star109180.cpp new file mode 100644 index 000000000..33b584cd2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109180/star109180.cpp @@ -0,0 +1,80 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star109180.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" +#include "regfile.h" + +void test::reset_loop() { + sc_uint<14> cell[2]; + sc_uint<14> cell1[2]; + + sc_uint<14> dat0, dat3; + sc_uint<14> out0, out3; + + dato.write(0); + dat0 = dat3 = out0 = out3 = 0; + ready.write(sc_logic('0')); + done.write(sc_logic('0')); + + wait(); + while (1) { + ready.write(sc_logic('1')); + wait(); + + ready.write(sc_logic('0')); + dat0 = dati.read(); + wait(); + + dat3 = dati.read(); + + cell[0] = dat0; + + cell1[1] = dat3; + + out0 = cell[0]; + out3 = cell1[1]; + + dato.write(out0); + done.write(sc_logic('1')); + wait(); + + dato.write(out3); + done.write(sc_logic('0')); + wait(); + + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star109218-2/COMPILE b/src/systemc/tests/systemc/misc/stars/star109218-2/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109218-2/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star109218-2/map.h b/src/systemc/tests/systemc/misc/stars/star109218-2/map.h new file mode 100644 index 000000000..c716f48f4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109218-2/map.h @@ -0,0 +1,51 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + map.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +SC_MODULE(test) { + sc_in_clk clk; + sc_in<bool> reset; + sc_in<sc_lv<16> > dati; + sc_out<sc_lv<16> > dato; + sc_out<sc_logic> done; + + SC_CTOR(test) { + SC_CTHREAD(reset_loop, clk.pos()); + reset_signal_is(reset,true); + } + + void reset_loop(void); +}; diff --git a/src/systemc/tests/systemc/misc/stars/star109218-2/star109218-2.cpp b/src/systemc/tests/systemc/misc/stars/star109218-2/star109218-2.cpp new file mode 100644 index 000000000..977b9998d --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109218-2/star109218-2.cpp @@ -0,0 +1,82 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star109218-2.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "map.h" + + +void my_mult(bool CLK, + sc_uint<8> A, + sc_uint<8> B, + sc_uint<16> &Z) { + // map_to_operator MULT_TC_OP + bool SignA, SignB; + sc_uint<8> MantA, MantB; + sc_uint<1> SignC; + sc_uint<16> MantC; + sc_lv<8> A_tmp, B_tmp; + sc_lv<16> Z_tmp; + + if(A == 0 || B == 0) { + Z = 0; + } else { + SignA = A[7]; + SignB = B[7]; + MantA = SignA? (sc_uint<8>) (0-A) : A; + MantB = SignB? (sc_uint<8>) (0-B) : B; + MantC = MantA*MantB; + SignC[0] = SignA ^ SignB; + MantC = SignC[0]? (sc_uint<16>) (0-MantC) : MantC; + Z = (SignC, MantC.range(14,0)); + } +} + + +void test::reset_loop() { + sc_uint<16> a, b, c, d, result; + + dato.write(0); + done.write((sc_logic)'0'); + wait(); + while(1) { + a = dati; + my_mult(clk.read(), a.range(7,0), a.range(15,8), result); + dato.write(result); + done.write((sc_logic)'1'); + wait(); + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star109218/COMPILE b/src/systemc/tests/systemc/misc/stars/star109218/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109218/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star109218/star109218.cpp b/src/systemc/tests/systemc/misc/stars/star109218/star109218.cpp new file mode 100644 index 000000000..89eb21a20 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109218/star109218.cpp @@ -0,0 +1,53 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star109218.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +void +star109218_imp(bool SignA, bool SignB, bool& SignC) +{ + sc_uint<1> tmpC; + tmpC[0] = SignA ^ SignB; + SignC = tmpC[0] ? 1 : 0; +} + + +void +star109218_ref(bool SignA, bool SignB, bool& SignC) +{ + SignC = (SignA != SignB); +} diff --git a/src/systemc/tests/systemc/misc/stars/star109678/COMPILE b/src/systemc/tests/systemc/misc/stars/star109678/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109678/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star109678/star109678.cpp b/src/systemc/tests/systemc/misc/stars/star109678/star109678.cpp new file mode 100644 index 000000000..afcf818a2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star109678/star109678.cpp @@ -0,0 +1,106 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star109678.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +SC_MODULE(test) { + sc_in_clk clk; + sc_in<bool> reset; + sc_in<sc_uint<10> > inp; + sc_out<sc_uint<10> > outp; + sc_out<sc_uint<10> > outp2; + + SC_CTOR(test) { + SC_CTHREAD(entry, clk.pos()); + reset_signal_is(reset,true); + SC_CTHREAD(entry2, clk.pos()); + end_module(); + } + + void entry(); + void entry2(); +}; + + +void test::entry() { + sc_uint<10> tmp, tmp2; + + outp.write(0); + wait(); + for(;;) { + if(inp.read() == 0) { + wait(); + while(inp.read() != 0) { + wait(); + tmp = inp.read(); + break; + } + break; + } else { + tmp = 5; + wait(); + } + } + wait(); + outp = tmp; + wait(); +} + + +void test::entry2() { + sc_uint<10> tmp, tmp2; + + outp2.write(0); + wait(); + for(;;) { + if(inp.read() == 0) { + wait(); + while(inp.read() != 0) { + wait(); + tmp = inp.read(); + continue; + } + break; + } else { + tmp = 5; + wait(); + } + } + wait(); + outp2 = tmp; + wait(); +} diff --git a/src/systemc/tests/systemc/misc/stars/star110069/COMPILE b/src/systemc/tests/systemc/misc/stars/star110069/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110069/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star110069/mem0.h b/src/systemc/tests/systemc/misc/stars/star110069/mem0.h new file mode 100644 index 000000000..039e1fb3a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110069/mem0.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + mem0.h -- + + Original Author: Stan Liao, Synopsys, Inc., 2000-09-19 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +typedef sc_signal<sc_bv<8> > sc_signal_bool_vector; + + +SC_MODULE( mem0 ) +{ + SC_HAS_PROCESS( mem0 ); + + sc_in_clk clk; + + //==================================================================== + // [C] Always Needed Member Function + // -- constructor + // -- entry + //==================================================================== + + const sc_signal<bool>& reset ; + const sc_signal_bool_vector& in_value1; // Input port + const sc_signal_bool_vector& in_value2 ; // Input port + const sc_signal<bool>& in_valid; // Input port + sc_signal_bool_vector& out_value1; // Output port + sc_signal_bool_vector& out_value2; // Output port + sc_signal<bool>& out_valid; // Output port + int* memory; + +int test; + // + // Constructor + // + + mem0 ( + sc_module_name NAME, // referense name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal_bool_vector& IN_VALUE1, + const sc_signal_bool_vector& IN_VALUE2, + const sc_signal<bool>& IN_VALID, // Input port + sc_signal_bool_vector& OUT_VALUE1, + sc_signal_bool_vector& OUT_VALUE2, + sc_signal<bool>& OUT_VALID, // Output port + int *MEMORY // Output port + ) + : + reset (RESET), + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_valid (IN_VALID), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_valid (OUT_VALID), + memory (MEMORY) + + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,true); + }; + + // + void entry (); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/stars/star110069/star110069.cpp b/src/systemc/tests/systemc/misc/stars/star110069/star110069.cpp new file mode 100644 index 000000000..a6ce0c671 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110069/star110069.cpp @@ -0,0 +1,80 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star110069.cpp -- + + Original Author: Stan Liao, Synopsys, Inc., 2000-09-19 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "mem0.h" + +void mem0::entry(){ + + + unsigned int tmp1; + unsigned int tmp2; +int test[16]; + // reset_loop + if (reset.read() == true) { + out_valid.write(false); + wait(); + } else wait(); + + // + // main loop + // + // + while(1) { + while(in_valid.read()==false) wait(); + wait(); + + //reading the inputs + tmp1 = in_value1.read().to_uint(); + tmp2 = in_value2.read().to_uint(); + + wait(); + wait(); + tmp2 = memory[tmp1]; + cout << "memory content " << tmp2 << endl; + // write outputs + out_value1.write( sc_bv<8>( tmp1 ) ); + out_value2.write( sc_bv<8>( tmp2 ) ); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/stars/star110089/COMPILE b/src/systemc/tests/systemc/misc/stars/star110089/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110089/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star110089/star110089.cpp b/src/systemc/tests/systemc/misc/stars/star110089/star110089.cpp new file mode 100644 index 000000000..912af5eab --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110089/star110089.cpp @@ -0,0 +1,403 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star110089.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/*********************************************************************** + +Things I had to do to make this work with the SystemC compiler + +Remove LP_STATS-related #ifdefs + +Added SystemC module interface. Odd function wrapper, wait()s. + +Removed use of pointers into lp_table (replaced with array references). + +Global variables are not allowed, so move lp_table into the function. + +Pointers appear to have problems, so comment out test of the "dev" field. + +The LP_POLLED macro checks lp_table[minor].dev->port->irq (three dereferences), +which is not synthesizable. I replaced it with a constant. + +w_ctr writes to the control I/O port. We want to observe this, so added +a port to the module, made the function a member function (not just static). + +Want to observe successive values on the control port, so added a wait() after +it is written. + +Adding the main do loop (there's an if () return statement earlier) +gives "WAITs not balanced" errors, even without any wait() statements +at all. Adding them doesn't appear to help (Evidentally, I'm not +adding them correctly.) + +How to model memory? Specifically, how to model copy_from_user() and +accesses to buffer memory? I'll create address, data, and read/write ports +for each memory space, memory access functions that toggle these ports, +and finally a replacement for copy_from_user(). + +Pointers seem to be broken (BC gives the inscrutable + + Error: Width mismatch on port 'n5[1]' of reference to 'group1' in + 'lp_write_buf.db:loop_117_design'. (LINK-3) + +so I'll use a pchar_t type as a replacement. + +The const declarations don't work now with typedef unsigned int pchar_t, so +I removed them. + +Was getting "unschedulable" errors until I inserted a few wait() statements. +(Very unhelpful diagnostics.) + +Inserting and removing wait()s at will seems to help, but I'm still getting +width mismatch errors. + +The width mismatch errors are due to a SystemC compiler bug. Adding +-Xgroup_idx_logic=0 to the command line eliminates them. + +Many "mismatched clock" statements appear to be due to the use of nested +return stataments. BC doesn't support exits from any more than a single +level of loop nesting, so whatever hack the SystemC people did is not solid. + +if statements with a return in one branch seems to cause unsolvable wait +balance problems. I'll rewrite many of them to put the code in the "else" +branch. + +For if-then with a return within a loop, I appear to need to add an error +flag and checks for it. + +Doing this makes the system schedulable, but even these few lines of code +turn into over 1 MB of .db file, take 300MB of core and ten minutes to run. +This corresponds to roughly 140 lines of C code: four conditionals, two +nested loops, and one function call. + +***********************************************************************/ + +typedef unsigned int pchar_t; + +/********************************************************************** + +SystemC-specific things + +**********************************************************************/ + +#include "systemc.h" + +SC_MODULE(lp_write_buf) { + sc_in_clk clk; + sc_in<bool> reset; + sc_in<unsigned> minor; + sc_in<unsigned> buf; /* a pointer */ + sc_in<int> count; + + sc_out<int> result; /* return code */ + sc_out<bool> result_ready; /* return flag */ + + sc_out<char> control; /* printer control port */ + + sc_inout<unsigned> user_addr; /* user memory address */ + sc_in<char> user_read_data; /* user data value */ + sc_out<bool> user_read; /* user memory read flag */ + + sc_out<unsigned> kernel_addr; /* kernel memory address */ + sc_in<char> kernel_read_data; /* kernel data value */ + sc_out<char> kernel_write_data; /* kernel data value */ + sc_out<bool> kernel_read; + sc_out<bool> kernel_write; + + sc_out<bool> invalid_read; /* debugging flag: should never be true */ + + void lp_write_buf_body(); + int lp_write_buf_f(unsigned int minor, pchar_t buf, int count); + + /* User and kernel memory operations */ + char read_from_user(unsigned a); + char read_from_kernel(unsigned a); + void write_to_kernel(unsigned a, char d); + + int copy_from_user(pchar_t, pchar_t, unsigned long); + + /* Output verification */ + void check_read_address(); + + SC_CTOR(lp_write_buf) + { + SC_CTHREAD(lp_write_buf_body, clk.pos()); + reset_signal_is(reset,true); + SC_CTHREAD(check_read_address, clk.pos()); + reset_signal_is(reset,true); + } +}; + +void lp_write_buf::check_read_address() +{ + /* This causes the systemC compiler a fatal internal error */ + for (;;) { + invalid_read = user_addr < buf || user_addr >= buf + count; + wait(); + } +} + + +void lp_write_buf::lp_write_buf_body() +{ + unsigned dummy; /* These three statements compensate for BC weirdness */ + dummy = 0; + wait(); + for (;;) { + result = 0; result_ready = 0; + unsigned res = lp_write_buf_f(minor, buf, count); + result = (int) res; result_ready = 1; + wait(); + result_ready = 0; + wait(); + } +} + +char lp_write_buf::read_from_user(unsigned a) +{ + char d; + user_addr = a; + user_read = 1; + wait(); + d = user_read_data; + user_read = 0; + wait(); + return d; +} + +char lp_write_buf::read_from_kernel(unsigned a) +{ + char d; + kernel_addr = a; + kernel_read = 1; + wait(); + d = kernel_read_data; + kernel_read = 0; + wait(); + return d; +} + +void lp_write_buf::write_to_kernel(unsigned a, char d) +{ + kernel_addr = a; + kernel_write_data = d; + kernel_write = 1; + wait(); + kernel_write = 0; + wait(); +} + +int lp_write_buf::copy_from_user(pchar_t src, pchar_t dest, + unsigned long count) +{ + for ( ; count > 0 ; count--) + write_to_kernel(dest++, read_from_user(src++)); + /* What about an error? */ + return 0; +} + +/******************************************************************** + "Normal" C begins here + ********************************************************************/ + +#define ENXIO 6 /* No such device or address */ +#define EFAULT 14 /* Bad address */ + +// #define NULL 0 + +#define LP_PINTEN 0x10 /* high to read data in or-ed with data out */ +#define LP_PSELECP 0x08 /* inverted output, active low */ +#define LP_PINITP 0x04 /* unchanged output, active low */ +#define LP_PAUTOLF 0x02 /* inverted output, active low */ +#define LP_PSTROBE 0x01 /* short high output on raising edge */ + +/* #define LP_POLLED(minor) (lp_table[(minor)].dev->port->irq == PARPORT_IRQ_NONE) */ +#define LP_POLLED(minor) 1 + +#define w_ctr(dev,val) (control = (val)) + +#define LP_NO 3 +#define LP_BUFFER_SIZE 32 + +struct lp_struct { + /* struct pardevice *dev; */ + pchar_t dev; + unsigned long flags; + unsigned int chars; + unsigned int time; + /* unsigned int wait; */ + pchar_t lp_buffer; + /* struct wait_queue *wait_q; */ + unsigned int last_error; + volatile unsigned int irq_detected:1; + volatile unsigned int irq_missed:1; +}; + +/* Write count bytes starting at buf in user space to the parallel port + defined by the minor device number */ + +int lp_write_buf::lp_write_buf_f(unsigned int minor, + pchar_t buf, int count) +{ + int err; + struct lp_struct lp_table[LP_NO]; + + /* Added to fake a device */ + lp_table[minor].dev = 5; + + unsigned long copy_size; + unsigned long total_bytes_written = 0; + unsigned long bytes_written; + /* Removed because pointers are prohibited */ + /* struct lp_struct *lp = &lp_table[minor]; */ + + if (minor >= LP_NO) { + wait(); + return -ENXIO; + } else { + + /* if (lp->dev == NULL) */ /* Removed because of a pointer */ + /* The following causes a BC error (bad matching width of n15[1]) */ + if (lp_table[minor].dev == 0) { + wait(); + return -ENXIO; + } else { + + lp_table[minor].last_error = 0; + lp_table[minor].irq_detected = 0; + lp_table[minor].irq_missed = 1; + + if (LP_POLLED(minor)) + w_ctr(minor, LP_PSELECP | LP_PINITP); + else + w_ctr(minor, LP_PSELECP | LP_PINITP | LP_PINTEN); + + err = 0; + wait(); + do { + wait(); + bytes_written = 0; + copy_size = (count <= LP_BUFFER_SIZE ? count : LP_BUFFER_SIZE); + + + /* Adding this gives width mismatch errors */ + if (copy_from_user(lp_table[minor].lp_buffer, buf, copy_size)) { + wait(); + w_ctr(minor, LP_PSELECP | LP_PINITP); + // return -EFAULT; + err = -EFAULT; + } else { + + /** Fake! **/ + bytes_written = copy_size; + +#if 0 + + while (copy_size) { + if (lp_char(lp->lp_buffer[bytes_written], minor)) { + --copy_size; + ++bytes_written; + } else { + int rc = total_bytes_written + bytes_written; + + + if (signal_pending(current)) + { + w_ctr(minor, LP_PSELECP | LP_PINITP); + if (total_bytes_written + bytes_written) + return total_bytes_written + bytes_written; + else + return -EINTR; + } + + if (lp_check_status(minor)) + { + w_ctr(minor, LP_PSELECP | LP_PINITP); + return rc ? rc : -EIO; + } + + if (LP_POLLED(minor) || + lp_table[minor].irq_missed) + { + lp_polling: + current->state = TASK_INTERRUPTIBLE; + lp_schedule(minor, LP_TIME(minor)); + } else { + cli(); + if (LP_PREEMPTED(minor)) + { + /* + * We can' t sleep on the interrupt + * since another pardevice need the port. + * We must check this in a cli() protected + * envinroment to avoid parport sharing + * starvation. + */ + sti(); + goto lp_polling; + } + if (!lp_table[minor].irq_detected) + interruptible_sleep_on_timeout(&lp->wait_q, LP_TIMEOUT_INTERRUPT); + sti(); + } + } + } + +#endif + + total_bytes_written += bytes_written; + buf += bytes_written; + count -= bytes_written; + + wait(); + } + + } while (count > 0 && err >= 0); + + wait(); + + if (err >= 0 ) { + + w_ctr(minor, LP_PSELECP | LP_PINITP); + return total_bytes_written; + } else { + return err; + } + + } + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star110668/COMPILE b/src/systemc/tests/systemc/misc/stars/star110668/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110668/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star110668/star110668.cpp b/src/systemc/tests/systemc/misc/stars/star110668/star110668.cpp new file mode 100644 index 000000000..eeecd640b --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110668/star110668.cpp @@ -0,0 +1,61 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star110668.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" +typedef struct tstruct { + sc_int<16> val1; + sc_int<16> val2; +} dummy_struct; +SC_MODULE(design) { + sc_in_clk clock; + sc_in <sc_int<8> > input; + sc_out<sc_int<8> > output; + void write_in_fifo(); + SC_CTOR(design) { + SC_CTHREAD(write_in_fifo, clock.pos() ); + } +}; +void design :: write_in_fifo() { + sc_int<8> data_in; + dummy_struct foofoo; + write_loop: while (1) { + data_in = input.read(); + foofoo.val1.range(0,7) = data_in; + output.write(foofoo.val2.range(8,15)); + wait(); + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star110672/COMPILE b/src/systemc/tests/systemc/misc/stars/star110672/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110672/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star110672/def.h b/src/systemc/tests/systemc/misc/stars/star110672/def.h new file mode 100644 index 000000000..adddd4e50 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110672/def.h @@ -0,0 +1,40 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + def.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#define RING_BUFFER_SIZE 16 +#define INDEX_TYPE sc_uint<5> +#define DATA_TYPE sc_int<8> diff --git a/src/systemc/tests/systemc/misc/stars/star110672/design.h b/src/systemc/tests/systemc/misc/stars/star110672/design.h new file mode 100644 index 000000000..7fc20e826 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110672/design.h @@ -0,0 +1,62 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + design.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +SC_MODULE(design) { + // ports + sc_in_clk clock; + sc_in<bool > take_the_data; + sc_in<bool > data_request; + sc_out<bool > data_ready; + sc_out<bool > write_in_is_done; + sc_in <DATA_TYPE > input; + sc_out<DATA_TYPE > output; + sc_signal<DATA_TYPE > ring_buffer[RING_BUFFER_SIZE]; + sc_signal<INDEX_TYPE > read_pointer; + sc_signal<INDEX_TYPE > write_pointer; + // processes + void write_in_fifo(); + void read_out_fifo(); + SC_CTOR(design) { + SC_CTHREAD(write_in_fifo, clock.pos() ); + SC_CTHREAD(read_out_fifo, clock.pos() ); + // bad reset + write_pointer = (INDEX_TYPE)0 ; + read_pointer = (INDEX_TYPE)0 ; + } + +}; diff --git a/src/systemc/tests/systemc/misc/stars/star110672/star110672.cpp b/src/systemc/tests/systemc/misc/stars/star110672/star110672.cpp new file mode 100644 index 000000000..f894ed0bd --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110672/star110672.cpp @@ -0,0 +1,58 @@ +/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+/*
+Please compile the program below with SC5.0. The output of the program is:
+
+sc_bit(1).to_char() = `
+
+where the last char in the line is a caro in my shell. It should be
+
+sc_bit(1).to_char() = 1
+*/
+
+
+#include <systemc.h>
+
+int sc_main(int argc, char* arg[])
+{
+ sc_bit dummy; // to force the deprecation message to come out first
+ // instead of in the middle of the next message
+ cout << "sc_bit(1).to_char() = " << sc_bit(1).to_char() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/stars/star110998/COMPILE b/src/systemc/tests/systemc/misc/stars/star110998/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110998/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star110998/star110998.cpp b/src/systemc/tests/systemc/misc/stars/star110998/star110998.cpp new file mode 100644 index 000000000..ba2e25f22 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110998/star110998.cpp @@ -0,0 +1,57 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star110998.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "systemc.h" +#include "test1.h" +#define SCAN_INTERVAL 200000 // 200 us +#define NS *1e-9 + + +void io_controller_m::control_write() +{ + sc_uint<32> word_cnt; + wait(); + + while(true) + { + wait(unsigned ((SCAN_INTERVAL NS)/40e-9)); + wait(); + + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star110998/test1.h b/src/systemc/tests/systemc/misc/stars/star110998/test1.h new file mode 100644 index 000000000..e97a607b4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star110998/test1.h @@ -0,0 +1,83 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test1.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +SC_MODULE(io_controller_m){ + + /* ports */ + sc_in_clk clk_i486_if; + + sc_out<sc_uint<30> > addr30_o; + sc_inout<sc_uint<32> > data32_i; + sc_out<sc_uint<32> > data32_o; + sc_out<bool> ads_n_o; + sc_out<bool> wr_n_o; + sc_in<bool> rdy_n_i; + sc_in<bool> ar_i; + sc_in<bool> res_n_i; + + sc_out<sc_uint<4> > mii_data4_o; + sc_out<bool> mii_en_o; + sc_in<sc_uint<4> > mii_data4_i; + sc_in<bool> mii_en_i; + sc_in<bool> mii_coll_det; + sc_in_clk clk_mii; + + /* signals */ + sc_signal<sc_uint<32> > mux_data32; + sc_signal<sc_uint<32> > in_fifo_data32; + sc_signal<sc_uint<32> > out_fifo_data32; + sc_signal<sc_uint<32> > control_data32; + sc_signal<bool> out_fifo_en; + sc_signal<bool> out_fifo_act; + sc_signal<bool> in_fifo_en; + sc_signal<bool> control_en; + sc_signal<bool> out_fifo_reset; + + /* variables */ + sc_uint<32> addr_tx_frame_ptr; + sc_uint<32> rx_ptr_array; + sc_signal<bool> value; + + SC_CTOR(io_controller_m) + { + + SC_CTHREAD(control_write, clk_i486_if.pos()); + + } + void control_write(); + +}; diff --git a/src/systemc/tests/systemc/misc/stars/star111004/COMPILE b/src/systemc/tests/systemc/misc/stars/star111004/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star111004/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star111004/io_controller.h b/src/systemc/tests/systemc/misc/stars/star111004/io_controller.h new file mode 100644 index 000000000..a63274904 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star111004/io_controller.h @@ -0,0 +1,191 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + io_controller.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/*############################################################################ +# Siemens AG copyright 2000 +# All Rights Reserved +# +# File name : io_controller.h +# +# Title : I/O-Controller +# +# Purpose : definitions for I/O-Controller-module +# +# Author : Hannes Muhr +# PSE EZE MSA +# +############################################################################## +# Modification History : +# +# +##############################################################################*/ + +#ifndef IO_CONTROLLER_INC +#define IO_CONTROLLER_INC + +#ifdef LOGGING +#include <fstream> +#endif +#include "systemc.h" +//#include "mii_if.h" +//#include "mbdatm.h" + +// class semaphore { + +// bool value; + +// public: +// semaphore(); +// void P(); +// void V(); +// bool get_value(); +// }; + +//void sc_trace(sc_trace_file *, const semaphore&, const std::string&); + +#ifdef LOGGING +/* stream for logging */ +extern ofstream flog; +#endif + +#define MII_FIFO_SIZE 400 +#define SCAN_INTERVAL 200000 // 200 us +#define NS *1e-9 + +SC_MODULE(io_controller_m){ + + /* ports */ + sc_in_clk clk_i486_if; + + sc_out<sc_uint<30> > addr30_o; + sc_inout<sc_uint<32> > data32_i; + sc_out<sc_uint<32> > data32_o; + sc_out<bool> ads_n_o; + sc_out<bool> wr_n_o; + sc_in<bool> rdy_n_i; + sc_in<bool> ar_i; + sc_in<bool> res_n_i; + + sc_out<sc_uint<4> > mii_data4_o; + sc_out<bool> mii_en_o; + sc_in<sc_uint<4> > mii_data4_i; + sc_in<bool> mii_en_i; + sc_in<bool> mii_coll_det; + sc_in_clk clk_mii; + + /* signals */ + sc_signal<sc_uint<32> > mux_data32; + sc_signal<sc_uint<32> > in_fifo_data32; + sc_signal<sc_uint<32> > out_fifo_data32; + sc_signal<sc_uint<32> > control_data32; + sc_signal<bool> out_fifo_en; + sc_signal<bool> out_fifo_act; + sc_signal<bool> in_fifo_en; + sc_signal<bool> control_en; + sc_signal<bool> out_fifo_reset; + + /* variables */ + sc_uint<32> addr_tx_frame_ptr; + sc_uint<32> rx_ptr_array; + sc_signal<bool> value; + + void P(); + void V(); + bool get_value(); + // semaphore sem; + + /* modules */ +// mux_m *mux; +// shifter_m *shifter; +// out_fifo_m *out_fifo; +// in_fifo_m *in_fifo; + + SC_CTOR(io_controller_m){ + + SC_CTHREAD(control_read, clk_i486_if.pos()); + +// mux = new mux_m("mux"); +// mux->clk(clk_mii); +// mux->data4_o(mii_data4_o); +// mux->data32_i(mux_data32); +// mux->en_i(out_fifo_act); +// mux->en_o(mii_en_o); + +// shifter = new shifter_m("shifter"); +// shifter->clk(clk_mii); +// shifter->data32_o(in_fifo_data32); +// shifter->data4_i(mii_data4_i); +// shifter->en_i(mii_en_i); +// shifter->en_o(in_fifo_en); + +// out_fifo = new out_fifo_m("out_fifo"); +// out_fifo->clk_out(clk_mii); +// out_fifo->clk_in(clk_i486_if); +// out_fifo->data32_o(mux_data32); +// out_fifo->data32_i(out_fifo_data32); +// out_fifo->en_i(out_fifo_en); +// out_fifo->act_o(out_fifo_act); +// out_fifo->reset(out_fifo_reset); + +// in_fifo = new in_fifo_m("in_fifo"); +// in_fifo->clk_out(clk_i486_if); +// in_fifo->clk_in(clk_mii); +// in_fifo->data32_o(control_data32); +// in_fifo->data32_i(in_fifo_data32); +// in_fifo->en_i(in_fifo_en); +// in_fifo->en_o(control_en); + +// /* Initialize */ +// in_fifo_data32 = (sc_uint<32>) 0; +// mux_data32 = (sc_uint<32>) 0; +// out_fifo_en = 0; +// out_fifo_act = 0; +// //en_o = 0; +// in_fifo_en = 0; +// control_en = 0; +// out_fifo_reset = 0; + + } + void control_write(); + void control_read(); + sc_uint<32> read_from_memory(sc_uint<32>); + void write_into_memory(sc_uint<32>, sc_uint<32>); + +}; + +#endif + diff --git a/src/systemc/tests/systemc/misc/stars/star111004/star111004.cpp b/src/systemc/tests/systemc/misc/stars/star111004/star111004.cpp new file mode 100644 index 000000000..152c050d3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star111004/star111004.cpp @@ -0,0 +1,269 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star111004.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/*############################################################################ +# Siemens AG copyright 2000 +# All Rights Reserved +# +# File name : io_controller.cpp +# +# Title : I/O-Controller +# +# Purpose : functionality for I/O-Controller-module +# +# Author : Hannes Muhr +# PSE EZE MSA +# +############################################################################## +# Modification History : +# +# +##############################################################################*/ + +#include "systemc.h" +#include "io_controller.h" + +#define MII_FRAME_SIZE 400 + +// ::semaphore(){ + +// value = false; +// } + +void io_controller_m::P(){ + + while (value) wait(); + value = true; +} + +void io_controller_m::V(){ + + /*if (!value) { + cerr << "V-operation on semaphore that is not P'd\n"; + exit(-1); + }*/ + value = false; +} + +bool io_controller_m::get_value(){ + + return value; +} + +/*void sc_trace(sc_trace_file *tf, const semaphore& sem, const std::string& str){ + + sc_trace(tf, sem.get_value(), str); +}*/ + +sc_uint<32> io_controller_m::read_from_memory(sc_uint<32> mp){ + + // read from mbdatm-memory over i486-IF + + addr30_o = mp >> 2; + ads_n_o = 0; + wr_n_o = 0; + wait(); + ads_n_o = 1; + do { wait(); } while (rdy_n_i == 1); + sc_uint<32> data = data32_i.read(); + wr_n_o = 1; + addr30_o = 0; + return data; +} + +void io_controller_m::write_into_memory(sc_uint<32> mp, sc_uint<32> data){ + + addr30_o = mp >> 2; + ads_n_o = 0; + wr_n_o = 1; + wait(); + ads_n_o = 1; + data32_o = data; + do { wait(); } while (rdy_n_i == 1); + wr_n_o = 1; + addr30_o = 0; + data32_o = 0; +} + +void io_controller_m::control_write(){ + sc_uint<32> word_cnt; + + if (!res_n_i.read()){ + do { wait(); } while (!res_n_i); + + // initialize + + // wait for 1. AR (HWS-Daten) + do { wait(); } while (!ar_i); + sc_uint<32> hws = data32_i.read(); + + wait(); + + // wait for 2. AR (ACB-Pointer) + do { wait(); } while (!ar_i); + addr_tx_frame_ptr = data32_i.read(); + + } + /* else if (mii_coll_det){ + out_fifo_reset = 1; + out_fifo_en = 0; + out_fifo_data32 = (sc_uint<32>) 0; + + // reset i486-IF + addr30_o = 0; + data32_io = 0; + ads_n_o = 1; + wr_n_o = 1; + + // release Semaphore if it is set + sem.V(); + + wait(); + out_fifo_reset = 0; + }*/ + + while(true){ + // normally Attention Request - Signal from MBDATM + // would wake up IO-Controller to read data from the memory, + // but the model from Hr. Wahl said: wait for some ms !!! + + // wait(unsigned ((SCAN_INTERVAL NS)/40e-9)); + //do { wait(); } while (ar_i); + + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::control_write - Attention Request" << endl; + #endif + + P(); + sc_uint<32> tx_frame_ptr = read_from_memory(addr_tx_frame_ptr); + if (tx_frame_ptr != 0) + word_cnt = read_from_memory(tx_frame_ptr+(MII_FIFO_SIZE+1)*4); + V(); + + // check, if frame available and frame is full (word_cnt == MII_FRAME_SIZE) + + while (tx_frame_ptr != 0 && word_cnt == MII_FRAME_SIZE){ + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::control_write - writing mii_frame into out_fifo" << endl; + #endif + + + for (int i = 0; i<MII_FIFO_SIZE; i++){ + // reading from i486-IF and writing into + // out_fifo is mixed, so read_from_memory could not be applied + + P(); + sc_uint<32> data = read_from_memory(tx_frame_ptr+i*4); + V(); + + out_fifo_en = 1; + out_fifo_data32 = data; + wait(); + out_fifo_en = 0; + + } + + while (out_fifo_act.read() != 0) wait(2); + + // write 0xFFFFFFFF (>MII_FRAME_SIZE) into tx_frame_ptr + // to signal software in mbdatm that io-controller has + // read out the frames and sent successfully + P(); + write_into_memory(tx_frame_ptr+(MII_FIFO_SIZE+1)*4, 0xFFFFFFFF); + V(); + + // read next frame_pointer and word_cnt from MBDATM + P(); + tx_frame_ptr = read_from_memory(tx_frame_ptr+MII_FIFO_SIZE*4); + if (tx_frame_ptr != 0) + word_cnt = read_from_memory(tx_frame_ptr+(MII_FIFO_SIZE+1)*4); + V(); + + + } + + } +} + +void io_controller_m::control_read(){ + + int arr_ptr = 0; + + while (true){ + do { wait(); } while (!control_en); + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::control_read " << endl; + #endif + + // read rx_frame_ptr from MBDATM + P(); + sc_uint<32> rx_frame_ptr = read_from_memory(rx_ptr_array+arr_ptr*4); + V(); + /*if (rx_frame_ptr == 0){ + cerr << "\nIO-Controller has read NULL-ptr from rx_array in MBDATM\n"; + cerr << "MBDATM did not fill rx_array fast enough\n"; + exit(-1); + }*/ + if (++arr_ptr == MII_FIFO_SIZE) + arr_ptr = 0; + + // write data from in_fifo into MBDATM-memory + for (int i = 0; i < MII_FIFO_SIZE-1; i++){ + sc_uint<32> d = control_data32.read(); + // grab the semaphore + P(); + write_into_memory(rx_frame_ptr + i*4, d); + // release semaphore + V(); + do { wait(); } while (!control_en); + + } + // separate last loop because we don't want to wait for + // another control_en at this time + sc_uint<32> d = control_data32.read(); + P(); + write_into_memory(rx_frame_ptr + (MII_FIFO_SIZE-1)*4, d); + V(); + + // write 0xFFFFFFFF into word_cnt from frame + // to indicate the software (MBDATM) that frame has been filled + P(); + write_into_memory(rx_frame_ptr + (MII_FIFO_SIZE+1)*4, 0xFFFFFFFF); + V(); + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star111657/COMPILE b/src/systemc/tests/systemc/misc/stars/star111657/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star111657/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star111657/io_controller1.h b/src/systemc/tests/systemc/misc/stars/star111657/io_controller1.h new file mode 100644 index 000000000..5d5f311df --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star111657/io_controller1.h @@ -0,0 +1,151 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + io_controller1.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +############################################################################ +# Siemens AG copyright 2000 +# All Rights Reserved +# +# File name : io_controller.h +# +# Title : I/O-Controller +# +# Purpose : definitions for I/O-Controller-module +# +# Author : Hannes Muhr +# PSE EZE MSA +# +############################################################################## +# Modification History : +# +# +##############################################################################*/ + +#ifndef IO_CONTROLLER_INC +#define IO_CONTROLLER_INC + +#ifdef LOGGING +#include <fstream> +#endif +#include "systemc.h" + + +#ifdef LOGGING +/* stream for logging */ +extern ofstream flog; +#endif + +#define SCAN_INTERVAL 200000 // 200 us +#define NS *1e-9 + +#define MII_FRAME_SIZE 400 + +SC_MODULE(io_controller_m){ + + /* ports */ + sc_in_clk clk_i486_if; + + sc_out<sc_uint<30> > addr30_o1; + sc_out<sc_uint<30> > addr30_o2; + sc_inout<sc_uint<32> > data32_i; + sc_out<sc_uint<32> > data32_o1; + sc_out<sc_uint<32> > data32_o2; + sc_out<bool> ads_n_o1; + sc_out<bool> ads_n_o2; + sc_out<bool> wr_n_o1; + sc_out<bool> wr_n_o2; + sc_in<bool> rdy_n_i; + sc_in<bool> ar_i; + sc_in<bool> res_n_i; + + sc_out<sc_uint<4> > mii_data4_o; + sc_out<bool> mii_en_o; + sc_in<sc_uint<4> > mii_data4_i; + sc_in<bool> mii_en_i; + sc_in<bool> mii_coll_det; + sc_in_clk clk_mii; + + /* signals */ + sc_signal<bool> start_mux; + sc_signal<bool> ready_mux; + sc_signal<bool> start_read; + sc_signal<bool> out_fifo_reset; + + /* variables */ + sc_uint<32> addr_tx_frame_ptr; + sc_uint<32> rx_ptr_array; + sc_signal<bool> sem1; // mutual exclusion for i486-if + sc_signal<bool> sem2; // mutual exclusion for i486-if + sc_uint<32> shared_mem1[MII_FRAME_SIZE]; // for write + sc_uint<32> shared_mem2[MII_FRAME_SIZE]; // for read + + SC_CTOR(io_controller_m){ + + SC_CTHREAD(control_write, clk_i486_if.pos()); + //reset_signal_is(mii_coll_det, true); + reset_signal_is(res_n_i, false); + + SC_CTHREAD(control_read, clk_i486_if.pos()); + + SC_CTHREAD(mux, clk_mii.pos()); + SC_CTHREAD(shift, clk_mii.pos()); + + + /* Initialize */ + start_mux = 0; + ready_mux = 0; + start_read = 0; + out_fifo_reset = 0; + + sem1 = false; + sem2 = false; + // init shared memory + for (int i=0; i < MII_FRAME_SIZE; i++) + shared_mem1[i] = shared_mem2[i] = 0; + } + void control_write(); + void control_read(); + void mux(); + void shift(); + sc_uint<32> read_from_memory0(sc_uint<32>); + sc_uint<32> read_from_memory1(sc_uint<32>); + void write_into_memory0(sc_uint<32>, sc_uint<32>); + void write_into_memory1(sc_uint<32>, sc_uint<32>); + +}; + +#endif diff --git a/src/systemc/tests/systemc/misc/stars/star111657/star111657.cpp b/src/systemc/tests/systemc/misc/stars/star111657/star111657.cpp new file mode 100644 index 000000000..5bcbaa724 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star111657/star111657.cpp @@ -0,0 +1,324 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star111657.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/*############################################################################ +# Siemens AG copyright 2000 +# All Rights Reserved +# +# File name : io_controller.cpp +# +# Title : I/O-Controller +# +# Purpose : functionality for I/O-Controller-module +# +# Author : Hannes Muhr +# PSE EZE MSA +# +############################################################################## +# Modification History : +# +# +##############################################################################*/ + +#include "systemc.h" +#include "io_controller1.h" + + +void io_controller_m::mux(){ + + sc_uint<32> data; + + while (true){ + while (start_mux.read() == 0) wait(); + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::select - enabled" << endl; + #endif + mii_en_o = 1; + for (int i = 0; i < MII_FRAME_SIZE; i++){ + data = shared_mem1[i]; + + mii_data4_o = data.range(3,0); + wait(); + mii_data4_o = data.range(7,4); + wait(); + mii_data4_o = data.range(11,8); + wait(); + mii_data4_o = data.range(15,12); + wait(); + mii_data4_o = data.range(19,16); + wait(); + mii_data4_o = data.range(23,20); + wait(); + mii_data4_o = data.range(27,24); + wait(); + mii_data4_o = data.range(31,28); + wait(); + } + mii_en_o = 0; + mii_data4_o = 0; + ready_mux = 1; + wait(); + ready_mux = 0; + wait(); + } +} + +void io_controller_m::shift(){ + + sc_uint<32> data; + + while (true){ + while (mii_en_i.read() == false) wait(); + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::collect - enabled" << endl; + #endif + + for (int i = 0; i < MII_FRAME_SIZE; i++){ + data.range(3,0) = mii_data4_i; + wait(); + data.range(7,4) = mii_data4_i; + wait(); + data.range(11,8) = mii_data4_i; + wait(); + data.range(15,12) = mii_data4_i; + wait(); + data.range(19,16) = mii_data4_i; + wait(); + data.range(23,20) = mii_data4_i; + wait(); + data.range(27,24) = mii_data4_i; + wait(); + data.range(31,28) = mii_data4_i; + shared_mem2[i] = data; + wait(); + } + start_read = 1; + wait(); + start_read = 0; + wait(); + } +} + +sc_uint<32> io_controller_m::read_from_memory0(sc_uint<32> mp){ + + // read from mbdatm-memory over i486-IF + + addr30_o1 = mp >> 2; + ads_n_o1 = 0; + wr_n_o1 = 0; + wait(); + ads_n_o1 = 1; + while (rdy_n_i.read() == 1) wait(); + sc_uint<32> data = data32_i.read(); + wr_n_o1 = 1; + addr30_o1 = 0; + return data; +} + +sc_uint<32> io_controller_m::read_from_memory1(sc_uint<32> mp){ + + // read from mbdatm-memory over i486-IF + + addr30_o2 = mp >> 2; + ads_n_o2 = 0; + wr_n_o2 = 0; + wait(); + ads_n_o2 = 1; + while (rdy_n_i.read() == 1) wait(); + sc_uint<32> data = data32_i.read(); + wr_n_o2 = 1; + addr30_o2 = 0; + return data; +} + +void io_controller_m::write_into_memory0(sc_uint<32> mp, sc_uint<32> data){ + + addr30_o1 = mp >> 2; + ads_n_o1 = 0; + wr_n_o1 = 1; + wait(); + ads_n_o1 = 1; + data32_o1 = data; + while (rdy_n_i.read() == 1) wait(); + wr_n_o1 = 1; + addr30_o1 = 0; + data32_o1 = 0; +} + +void io_controller_m::write_into_memory1(sc_uint<32> mp, sc_uint<32> data){ + + addr30_o2 = mp >> 2; + ads_n_o2 = 0; + wr_n_o2 = 1; + wait(); + ads_n_o2 = 1; + data32_o2 = data; + while (rdy_n_i.read() == 1) wait(); + wr_n_o2 = 1; + addr30_o2 = 0; + data32_o2 = 0; +} + +void io_controller_m::control_write(){ + sc_uint<32> word_cnt; + + while (res_n_i.read() == 0) wait(); + + // initialize + + // wait for 1. AR (HWS-Daten) + while (ar_i.read() == 0) wait(); + sc_uint<32> hws = data32_i.read(); + + wait(); + + // wait for 2. AR (ACB-Pointer) + while (ar_i.read() == 0) wait(); + addr_tx_frame_ptr = data32_i.read(); + wait(); + + + while(true){ + // normally Attention Request - Signal from MBDATM + // would wake up IO-Controller to read data from the memory, + // but the model from Hr. Wahl said: wait for some ms !!! + + wait(1000); + + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::control_write - Attention Request" << endl; + #endif + + while (sem2) wait(); sem2 = true; // P-operation + sc_uint<32> tx_frame_ptr = read_from_memory0(addr_tx_frame_ptr); + if (tx_frame_ptr != 0) + word_cnt = read_from_memory0(tx_frame_ptr+(MII_FRAME_SIZE+1)*4); + sem2 = false; // V-operation + + // check, if frame available and frame is full (word_cnt == MII_FRAME_SIZE) + + while (tx_frame_ptr != 0 && word_cnt == MII_FRAME_SIZE){ + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::control_write - writing mii_frame into out_fifo" << endl; + #endif + + + for (int i = 0; i<MII_FRAME_SIZE; i++){ + // reading from i486-IF and writing into + // out_fifo is mixed, so read_from_memory could not be applied + + while (sem2) wait(); sem2 = true; // P-operation + sc_uint<32> data = read_from_memory0(tx_frame_ptr+i*4); + sem2 = false; // V-operation + + if (i == 0){ + start_mux = 1; + shared_mem1[i] = data; + wait(); + start_mux = 0; + } + else { + shared_mem1[i] = data; + wait(); + } + // wait(); ?? + } + + while (ready_mux.read() == 0) wait(); + + // write 0xFFFFFFFF (>MII_FRAME_SIZE) into tx_frame_ptr + // to signal software in mbdatm that io-controller has + // read out the frames and sent successfully + while (sem2) wait(); sem2 = true; // P-operation + write_into_memory0(tx_frame_ptr+(MII_FRAME_SIZE+1)*4, 0xFFFFFFFF); + sem2 = false; // V-operation + + // read next frame_pointer and word_cnt from MBDATM + while (sem2) wait(); sem2 = true; // P-operation + tx_frame_ptr = read_from_memory0(tx_frame_ptr+MII_FRAME_SIZE*4); + if (tx_frame_ptr != 0) + word_cnt = read_from_memory0(tx_frame_ptr+(MII_FRAME_SIZE+1)*4); + sem2 = false; // V-operation + + + } + + } +} + +void io_controller_m::control_read(){ + + int arr_ptr = 0; + + while (true){ + while (start_read.read() == 0) wait(); + #ifdef LOGGING + flog << sc_time_stamp()<<": "<<name()<<"::control_read " << endl; + #endif + + // read rx_frame_ptr from MBDATM + while (sem1) wait(); sem1 = true; // P-operation + sc_uint<32> rx_frame_ptr = read_from_memory1(rx_ptr_array+arr_ptr*4); + sem1 = false; // V-operation + /*if (rx_frame_ptr == 0){ + cerr << "\nIO-Controller has read NULL-ptr from rx_array in MBDATM\n"; + cerr << "MBDATM did not fill rx_array fast enough\n"; + exit(-1); + }*/ + if (++arr_ptr == MII_FRAME_SIZE) + arr_ptr = 0; + + // write data from in_fifo into MBDATM-memory + for (int i = 0; i < MII_FRAME_SIZE; i++){ + sc_uint<32> d = shared_mem2[i]; + // grab the semaphore + while (sem1) wait(); sem1 = true; // P-operation + write_into_memory1(rx_frame_ptr + i*4, d); + // release semaphore + sem1 = false; // V-operation + wait(); + + } + + // write 0xFFFFFFFF into word_cnt from frame + // to indicate the software (MBDATM) that frame has been filled + while (sem1) wait(); sem1 = true; // P-operation + write_into_memory1(rx_frame_ptr + (MII_FRAME_SIZE+1)*4, 0xFFFFFFFF); + sem1 = false; // V-operation + } +} + diff --git a/src/systemc/tests/systemc/misc/stars/star113320/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113320/golden/test.log new file mode 100644 index 000000000..a3730887a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113320/golden/test.log @@ -0,0 +1,4 @@ +SystemC Simulation +a=10 +b=0000001010 +c=10 diff --git a/src/systemc/tests/systemc/misc/stars/star113320/test.cpp b/src/systemc/tests/systemc/misc/stars/star113320/test.cpp new file mode 100644 index 000000000..6688626bd --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113320/test.cpp @@ -0,0 +1,98 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Ulli Holtmann, Nov/10/00 + +I would like to convert between sc_int and sc_bv like in this example: +*/ + +#include "systemc.h" + +int sc_main(int argc, char* arg[]) +{ + sc_int<10> a; + sc_bv<10> b; + sc_int<7> c; + + a=10; cout << "a="<< a << "\n"; + b=a; cout << "b="<< b << "\n"; + c=b; cout << "c="<< c << "\n"; + + return 0; +} + +/* +This doesn't work on with either SC5.0 or g++ for different reasons. + +SC 5.0 +------------------------------------ +compile error at assignment "c=b" == sc_int<7> = sc_bv<10> : + +"/view/ccss_ulli/vobs/abc/src/scenic/scenery/include/sc_lv.h", line 165: Error: The function "convert" must have a prototype. +"str.cc", line 12: Where: While instantiating "sc_bv_ns::sc_lv<7>::sc_lv(const sc_bv_ns::sc_bv_base&)". +"str.cc", line 12: Where: Instantiated from non-template code. + +file sc_lv.h: +#if !defined(__SUNPRO_CC) + template<class Y> sc_lv(const sc_proxy<Y>& y) + {init(y.back_cast().length()); assign_(y);} + template<class T> sc_lv& operator=(const sc_proxy<T>& t) + { sc_bv_ns::assign_(*this,t); return *this;} +#else + // at least some constructors + sc_lv(const sc_bv<W>& t){convert(t);verify_length();} + sc_lv(const sc_lv_base& y):sc_lv_base(y){verify_length();} + sc_lv(const sc_bv_base& t){convert(t);verify_length();} +#endif + +Apparently, the "convert" function is undeclared. + + +With gcc +------------------------------------ +compiles fine, but then Abort at assignment "b=a" == sc_bv<10> = sc_int<10> : + +a=10 +Abort (core dumped) + + + +I am using SystemC 1.0.1 (stellar does not yet have a 1.0.1 release entry). on +a Solaris 5.5.1 host with SC5.0 or g++ 2.95.2 +*/ + diff --git a/src/systemc/tests/systemc/misc/stars/star113321/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113321/golden/test.log new file mode 100644 index 000000000..9a9b5d67a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113321/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +0001110000 diff --git a/src/systemc/tests/systemc/misc/stars/star113321/test.cpp b/src/systemc/tests/systemc/misc/stars/star113321/test.cpp new file mode 100644 index 000000000..97171fe7a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113321/test.cpp @@ -0,0 +1,68 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Nov/10/00 ulrich + +The SystemC 1.0 manual says that the bit-wise AND operator is supported for +class sc_bv like here: +*/ + +#include "systemc.h" + +int sc_main(int argc, char* arg[]) +{ + sc_bv<10> a = "01111111"; + sc_bv<10> b = "11110000"; + sc_bv<10> c = a & b; + cout << c << "\n"; + + return 0; +} + +/* +It does work fine with g++. +But SC5.0 gives this compile error: + + CC -pto -g -I. -I/view/ccss_ulli/vobs/abc/src/scenic/scenery/include -I. -I/view/ccss_ulli/vobs/abc/src/scenic/scenery/include -c str.cc + "str.cc", line 7: Error: Cannot use const sc_bv_ns::sc_bitwise_and<sc_bv_ns::sc_bv_base,sc_bv_ns::sc_bv_base> + to initialize sc_bv_ns::sc_bv<10>. + + +I used SystemC 1.0.1 on a Solaris 5.5.1 machines with SC5.0 +*/ + diff --git a/src/systemc/tests/systemc/misc/stars/star113623/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113623/golden/test.log new file mode 100644 index 000000000..fb1f2d102 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113623/golden/test.log @@ -0,0 +1,4 @@ +SystemC Simulation +0 +9 +9 diff --git a/src/systemc/tests/systemc/misc/stars/star113623/test.cpp b/src/systemc/tests/systemc/misc/stars/star113623/test.cpp new file mode 100644 index 000000000..40bfc3be9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113623/test.cpp @@ -0,0 +1,87 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +I have closed the star. The testcase I'm attaching shows that Cthreads +used to sample the inputs at the beginnig and therefor it took 2 +cycles to see the results back in sc_main. Hope you could take the +action to include it in the regression systemc, since I don't know +what system you guys are using. + +Thanks, +Rocco +*/ + +#include "systemc.h" + +SC_MODULE(adder_reg) { + sc_in<sc_int<8> > a; + sc_in<sc_int<8> > b; + sc_out<sc_int<9> > c; + //sc_in<bool> clk; + sc_in_clk clk; + +void add() { + // c.write(a.read() + b.read()); // *** THIS WON'T COMPILE *** + c = a.read() + b.read(); // Must use read() method + } + +SC_CTOR(adder_reg) { + SC_CTHREAD(add, clk.pos()); + } +}; + +int sc_main(int argc, char *argv[]) +{ + sc_signal< sc_int<8> > a; + sc_signal< sc_int<8> > b; + sc_signal< sc_int<9> > c; + sc_clock clk("CLK", 10, SC_NS, 0.5, 0.0, SC_NS); + adder_reg adder_reg("adder"); + adder_reg(a, b, c, clk); + a = 3; + b = 6; + cout << c.read().to_int() << endl; + sc_start(10, SC_NS); + cout << c.read().to_int() << endl; + sc_start(10, SC_NS); + + // CynAppsTwo clocks to get the answer. + // Rocco: No with SC_METHOD it take 1 cycle + cout << c.read().to_int() << endl; + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star113632/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113632/golden/test.log new file mode 100644 index 000000000..5c32209e7 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113632/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +0010 diff --git a/src/systemc/tests/systemc/misc/stars/star113632/test.cpp b/src/systemc/tests/systemc/misc/stars/star113632/test.cpp new file mode 100644 index 000000000..738805343 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113632/test.cpp @@ -0,0 +1,67 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Ulli Holtmann, Nov/17/00 + +with SystemC 1.0.1, on sparcOS5, SC5.0 compiler, I can't assign a sc_bv::range() bit-slice +to a sc_bv: +*/ + +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + sc_bv<4> bv4; + sc_bv<10> bv10 = 5; + + bv4 = bv10.range(4,1); + // g++: OK + // SC5.0: Error + // "str.cc", line 8: Error: Cannot assign + // sc_bv_ns::sc_range<sc_bv_ns::sc_bv_base> to + // sc_bv_ns::sc_bv<4> without + // "sc_bv_ns::sc_bv<4>::operator=(const sc_bv_ns::sc_bv<4>&)";. + cout << bv4 << endl; + + return 0; +} + +/* +It works fine with g++, though. +*/ diff --git a/src/systemc/tests/systemc/misc/stars/star113726/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113726/golden/test.log new file mode 100644 index 000000000..50ab2778d --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113726/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation +-1 +0001 diff --git a/src/systemc/tests/systemc/misc/stars/star113726/test.cpp b/src/systemc/tests/systemc/misc/stars/star113726/test.cpp new file mode 100644 index 000000000..2acf62aba --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113726/test.cpp @@ -0,0 +1,54 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_int<4> a; + a = 127; + cout << a << endl; + + sc_bv<2> b = "01"; + sc_bv<4> c = "1010"; + + c = b; + cout << c << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star113946/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113946/golden/test.log new file mode 100644 index 000000000..6d243dcc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113946/golden/test.log @@ -0,0 +1 @@ +SystemC Simulation diff --git a/src/systemc/tests/systemc/misc/stars/star113946/test.cpp b/src/systemc/tests/systemc/misc/stars/star113946/test.cpp new file mode 100644 index 000000000..caf9047e8 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113946/test.cpp @@ -0,0 +1,57 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + // Given two signals: + sc_signal<sc_uint<4> > input, new_input; + + // I cannot do the following: + new_input.write(input); // Fails g++ + + // The others combinations work: + new_input = input; // works + new_input.write(input.read()); // works + new_input = input.read(); // works + + // It would be more consistant if all 4 worked. + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star113999/golden/test.log b/src/systemc/tests/systemc/misc/stars/star113999/golden/test.log new file mode 100644 index 000000000..77cf9f907 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113999/golden/test.log @@ -0,0 +1,17 @@ +SystemC Simulation + +Info: (I804) /IEEE_Std_1666/deprecated: sc_bit is deprecated, use bool instead +0 +1 +1 + +Error: (E204) value is not valid: sc_bit( 2 ) +In file: <removed by verify.pl> + +Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about + IEEE 1666 deprecated features by placing this method call + as the first statement in your sc_main() function: + + sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", + sc_core::SC_DO_NOTHING ); + diff --git a/src/systemc/tests/systemc/misc/stars/star113999/test.cpp b/src/systemc/tests/systemc/misc/stars/star113999/test.cpp new file mode 100644 index 000000000..7c45c1508 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star113999/test.cpp @@ -0,0 +1,114 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Nov/29/00 Ulli Holtmann + +Assignment of values other than 0 or 1 to an sc_bit results in a core dump +on Sparc SC5.0 as well as g++. I used SystemC 1.0.1 + +I can understand that only 0 and 1 make sense, so please either forbid +assignment from an integer and cast the integer to bool first. A core dump is +a bit to drastic. + +Example: +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_bit res; + + // works fine + res = 0; cout << res << "\n"; + res = 1; cout << res << "\n"; + res = bool(2); cout << res << "\n"; + + // results in a core dump + res = sc_bit(2); cout << res << "\n"; + res = 2; cout << res << "\n"; + + return 0; +} + + +/* +Dec/7/00 ulrich + +Hi Gene, + +I agree that the assignment of values other than 0,1 doesn't make much sense, so please go ahead +and forbid it in one way or another. However, such an illegal assignment may easily happen in a +user-program because the compiler accepts it. It very easy to write. + +The point I dislike is that the class library immediately core dumps without any warning or +explanation. Does SystemC throw an exception? I don't know and I most likely will not write +an exception handler, therefore I will never know. I just see that the SystemC kernel core +dumps. + +What about an assert statement such like + assert(v==0 || v==1); +That should me as the user a precise and reasonable explanation that I made a mistake. I could +also accept an error message like E200x or so coming like when I enter illlegal bit characters, +e.g. sc_bv<10>="102abd00". But please, not just a core dump. + + + +Jan/9/01 ulrich + +Hi Gene, I still only ask that the program does not core dump and instead prints an error +message or warning like it does for sc_logic. I only object to the core dump itself. Example: + + +int main(int argc, char* arg[]) +{ + sc_logic l (5); + cout << l << "\n"; + + sc_bit b(2); + cout << b << "\n"; +} + +Both are invalid assignments. The first one prompt a warning (1006), the second a core +dump. Both should prompt warnings/run time errors. + +I reduce the prioity to B2 because it's now only a matter of properly reporting an error. + +Other than +this, I can share your view that assigning 2 is a user error. +*/ diff --git a/src/systemc/tests/systemc/misc/stars/star114085/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114085/golden/test.log new file mode 100644 index 000000000..ee5eb4490 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114085/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +0000000000000000000000000000000000000000000000000000000000011100 diff --git a/src/systemc/tests/systemc/misc/stars/star114085/test.cpp b/src/systemc/tests/systemc/misc/stars/star114085/test.cpp new file mode 100644 index 000000000..842b416b2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114085/test.cpp @@ -0,0 +1,61 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Dec/1/00 Ulli Holtmann + +The following program works fine with gcc on Solaris but does not compile with SC5.0: +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_bv<64> bv = "0111"; + sc_bv<64> res; + + res = bv << 2; + + // gcc: OK + // SC5.0: Error: Cannot assign const + // sc_bv_ns::sc_shift_left<sc_bv_ns::sc_bv_base> to sc_bv_ns::sc_bv<64> + // without "sc_bv_ns::sc_bv<64>::operator=(const sc_bv_ns::sc_bv<64>&)";. + + cout << res.to_string() << "\n"; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114104/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114104/golden/test.log new file mode 100644 index 000000000..930acd999 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114104/golden/test.log @@ -0,0 +1,53 @@ +SystemC Simulation +0 s: 0 +0 s: negedge +3 ns: 1 +3 ns: posedge +6 ns: Z +9 ns: X +12 ns: 0 +12 ns: negedge +15 ns: 1 +15 ns: posedge +18 ns: Z +21 ns: X +24 ns: 0 +24 ns: negedge +27 ns: 1 +27 ns: posedge +30 ns: Z +33 ns: X +36 ns: 0 +36 ns: negedge +39 ns: 1 +39 ns: posedge +42 ns: Z +45 ns: X +48 ns: 0 +48 ns: negedge +51 ns: 1 +51 ns: posedge +54 ns: Z +57 ns: X +60 ns: 0 +60 ns: negedge +63 ns: 1 +63 ns: posedge +66 ns: Z +69 ns: X +72 ns: 0 +72 ns: negedge +75 ns: 1 +75 ns: posedge +78 ns: Z +81 ns: X +84 ns: 0 +84 ns: negedge +87 ns: 1 +87 ns: posedge +90 ns: Z +93 ns: X +96 ns: 0 +96 ns: negedge +99 ns: 1 +99 ns: posedge diff --git a/src/systemc/tests/systemc/misc/stars/star114104/test.cpp b/src/systemc/tests/systemc/misc/stars/star114104/test.cpp new file mode 100644 index 000000000..a9da5b8cc --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114104/test.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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// test of sc_signal<sc_logic> posedge and negedge + +#include "systemc.h" + +SC_MODULE( pro ) +{ + sc_out<sc_logic> out; + + void main_action() + { + int i = 0; + while( true ) { + sc_logic tmp( i ); + out.write( tmp ); + cout << sc_time_stamp() << ": " << tmp.to_char() << endl; + wait( 3, SC_NS ); + i = (i + 1) % 4; + } + } + + SC_CTOR( pro ) + { + SC_THREAD( main_action ); + } +}; + +SC_MODULE( con ) +{ + sc_in<sc_logic> in; + + void pos_action() + { + cout << sc_time_stamp() << ": posedge" << endl; + } + + void neg_action() + { + cout << sc_time_stamp() << ": negedge" << endl; + } + + SC_CTOR( con ) + { + SC_METHOD( pos_action ); + sensitive << in.pos(); + dont_initialize(); + SC_METHOD( neg_action ); + sensitive << in.neg(); + dont_initialize(); + } +}; + +int +sc_main( int, char*[] ) +{ + sc_signal<sc_logic> sig; + pro p( "p" ); + con c( "c" ); + p.out( sig ); + c.in( sig ); + sc_start( 100, SC_NS ); + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114203/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114203/golden/test.log new file mode 100644 index 000000000..4cc6a08b9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114203/golden/test.log @@ -0,0 +1,4 @@ +SystemC Simulation +0000111100 +0b0000111100 +0b00000111100 diff --git a/src/systemc/tests/systemc/misc/stars/star114203/test.cpp b/src/systemc/tests/systemc/misc/stars/star114203/test.cpp new file mode 100644 index 000000000..eeecc1fc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114203/test.cpp @@ -0,0 +1,81 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Dec/5/00 ulrich + +The constructor of an sc_biguint with an sc_bv as an argument does not +compile. That happens with SystemC 1.0.1 on Solaris with both SC5.0 +and gcc. +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_bv<10> bv10 = "0000111100"; + sc_bigint<10> bi10; + sc_biguint<10> bu10; + + // works fine + bi10 = sc_bigint<10> (bv10); + + // causes errors on g++, SC5.0 : + // g++ : + // .../include/numeric_bit/sc_biguint.h: + // In method `sc_biguint<10>::sc_biguint(const sc_bv_ns::sc_bv<10> &)': + // str.cc:10: instantiated from here + // .../include/numeric_bit/sc_biguint.h:186: type `sc_signed' + // is not a base type for type `sc_biguint<10>' + // .../include/numeric_bit/sc_unsigned.h:1365: + // `sc_unsigned::sc_unsigned()' is private + // .../include/numeric_bit/sc_biguint.h:186: within this context + // SC5.0: + // ".../include/numeric_bit/sc_biguint.h", line 186: + // Error: sc_signed is not a direct base class of sc_biguint<10>. + // ".../include/numeric_bit/sc_biguint.h", line 187: + // Error: sc_unsigned::sc_unsigned() is not accessible from . + + bu10 = sc_biguint<10>(bv10); + + + cout << bv10.to_string() << endl; + cout << bi10.to_string(SC_BIN) << endl; + cout << bu10.to_string(SC_BIN) << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114477/design.h b/src/systemc/tests/systemc/misc/stars/star114477/design.h new file mode 100644 index 000000000..59b82d72c --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114477/design.h @@ -0,0 +1,79 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + design.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +struct fun:sc_module +{ + sc_in<bool> clk; + sc_in<int> count; + sc_bv<9> x,y,z; + sc_out<sc_bv<9> > out_a0, out_a1; + + SC_CTOR(fun) { + SC_METHOD(entry1); + sensitive << clk; + SC_METHOD(entry2); + sensitive << clk; +} + + void entry1(); + void entry2(); +}; + +void fun::entry1() +{ + z = 0; + z[0] = x[1]&y[2]; + z[0] = x[1]|y[2]; + z[0] = x[1]^y[2]; + out_a0 = z; + out_a1 = x; +} + + +void fun::entry2() +{ + if (count%3==0) { + x = 120; + y = 10; + } + else { + x = 44; + y = 5; + } +} diff --git a/src/systemc/tests/systemc/misc/stars/star114477/design_rtl.h b/src/systemc/tests/systemc/misc/stars/star114477/design_rtl.h new file mode 100644 index 000000000..fb88969c0 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114477/design_rtl.h @@ -0,0 +1,203 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + design_rtl.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> + +SC_MODULE(fun) { +public: + sc_in<sc_uint<1> > clk; + sc_in<sc_uint<32> > count; + sc_out<sc_uint<9> > out_a0; + sc_out<sc_uint<9> > out_a1; + SC_CTOR(fun) { + SC_METHOD(p1); + sensitive << count << out_a1; + }; +private: + + template<int w> sc_int<w> int_conv_from_sc_uint_to_sc_int ( sc_uint<w> + a) { + sc_int<w> a_temp; + for (int i=0;i<w; i++) + a_temp[i] = a[i]; + return a_temp; + } + + template<int w> sc_bigint<w> int_conv_from_sc_biguint_to_sc_bigint ( + sc_biguint<w> a) { + sc_bigint<w> a_temp; + for (int i=0;i<w; i++) + a_temp[i] = a[i]; + return a_temp; + } + + template<int w> sc_int<w> int_conv_from_sc_uint_to_sc_int ( bool a) { + sc_int<w> a_temp; + a_temp[0] = a; + return a_temp; + } + + + sc_uint<32> C18_B, C18_REMAINDER; + bool N73, N74, N75, N76, N77, N78, N79, N80, N81, N82, N83, N84, N85, + N86, N87, N88, N89, N90, N91, N92, N93, N94, N95, N96, N97, N98, + N99, N100, N101, N102, N103, N104, N105, N106, N107, N108, N109, + N110, N111, N112, N113, N114, N115, N116, N117, N118, N119, N120, + N121, N122, N123, N124, N125, N126, N127, N128, N129, N130, N131, + N132, N133, N134; + + void p1( ) { + out_a1[0].write( 0 ); + out_a1[1].write( 0 ); + out_a1[3].write( 1 ); + out_a1[5].write( 1 ); + out_a1[7].write( 0 ); + out_a1[8].write( 0 ); + out_a0[2].write( (0 ^ 1) ); + out_a0[5].write( (0 ^ 1) ); + C18_B[31] = 0 ; + C18_B[30] = 0 ; + C18_B[29] = 0 ; + C18_B[28] = 0 ; + C18_B[27] = 0 ; + C18_B[26] = 0 ; + C18_B[25] = 0 ; + C18_B[24] = 0 ; + C18_B[23] = 0 ; + C18_B[22] = 0 ; + C18_B[21] = 0 ; + C18_B[20] = 0 ; + C18_B[19] = 0 ; + C18_B[18] = 0 ; + C18_B[17] = 0 ; + C18_B[16] = 0 ; + C18_B[15] = 0 ; + C18_B[14] = 0 ; + C18_B[13] = 0 ; + C18_B[12] = 0 ; + C18_B[11] = 0 ; + C18_B[10] = 0 ; + C18_B[9] = 0 ; + C18_B[8] = 0 ; + C18_B[7] = 0 ; + C18_B[6] = 0 ; + C18_B[5] = 0 ; + C18_B[4] = 0 ; + C18_B[3] = 0 ; + C18_B[2] = 0 ; + C18_B[1] = 1 ; + C18_B[0] = 1 ; + + // REM_UNS_OP(A,B,REMAINDER) + REM_UNS_OP( count.read(), C18_B, C18_REMAINDER ); + } + out_a0[7].write( (0 ^ 0) ); + out_a0[8].write( (0 ^ 0) ); + N73 = !(C18_REMAINDER[31]); + N74 = !(C18_REMAINDER[30]); + N76 = !(C18_REMAINDER[29]); + N78 = !(C18_REMAINDER[28]); + N80 = !(C18_REMAINDER[27]); + N82 = !(C18_REMAINDER[26]); + N84 = !(C18_REMAINDER[25]); + N86 = !(C18_REMAINDER[24]); + N88 = !(C18_REMAINDER[23]); + N90 = !(C18_REMAINDER[22]); + N92 = !(C18_REMAINDER[21]); + N94 = !(C18_REMAINDER[20]); + N96 = !(C18_REMAINDER[19]); + N98 = !(C18_REMAINDER[18]); + N100 = !(C18_REMAINDER[17]); + N102 = !(C18_REMAINDER[16]); + N104 = !(C18_REMAINDER[15]); + N106 = !(C18_REMAINDER[14]); + N108 = !(C18_REMAINDER[13]); + N110 = !(C18_REMAINDER[12]); + N112 = !(C18_REMAINDER[11]); + N114 = !(C18_REMAINDER[10]); + N116 = !(C18_REMAINDER[9]); + N118 = !(C18_REMAINDER[8]); + N120 = !(C18_REMAINDER[7]); + N122 = !(C18_REMAINDER[6]); + N124 = !(C18_REMAINDER[5]); + N126 = !(C18_REMAINDER[4]); + N128 = !(C18_REMAINDER[3]); + N130 = !(C18_REMAINDER[2]); + N132 = !(C18_REMAINDER[1]); + N134 = !(C18_REMAINDER[0]); + N75 = (N73 && N74); + N77 = (N75 && N76); + N79 = (N77 && N78); + N81 = (N79 && N80); + N83 = (N81 && N82); + N85 = (N83 && N84); + N87 = (N85 && N86); + N89 = (N87 && N88); + N91 = (N89 && N90); + N93 = (N91 && N92); + N95 = (N93 && N94); + N97 = (N95 && N96); + N99 = (N97 && N98); + N101 = (N99 && N100); + N103 = (N101 && N102); + N105 = (N103 && N104); + N107 = (N105 && N106); + N109 = (N107 && N108); + N111 = (N109 && N110); + N113 = (N111 && N112); + N115 = (N113 && N114); + N117 = (N115 && N116); + N119 = (N117 && N118); + N121 = (N119 && N120); + N123 = (N121 && N122); + N125 = (N123 && N124); + N127 = (N125 && N126); + N129 = (N127 && N128); + N131 = (N129 && N130); + N133 = (N131 && N132); + out_a1[6].write( (N133 && N134) ); + out_a1[4].write( out_a1.read()[6] ); + out_a0[3].write( (0 ^ out_a1.read()[6]) ); + out_a0[4].write( (0 ^ out_a1.read()[6]) ); + out_a0[6].write( (0 ^ out_a1.read()[6]) ); + out_a1[2].write( !(out_a1.read()[6]) ); + out_a0[0].write( (out_a1.read()[2] ^ 0) ); + out_a0[1].write( (out_a1.read()[6] ^ out_a1.read()[2]) ); + + } + +}; diff --git a/src/systemc/tests/systemc/misc/stars/star114477/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114477/golden/test.log new file mode 100644 index 000000000..4c75a8959 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114477/golden/test.log @@ -0,0 +1,11 @@ +SystemC Simulation +constants 000000000 001111000 +constants 000000001 000101100 +constants 000000001 000101100 +constants 000000000 001111000 +constants 000000001 000101100 +constants 000000001 000101100 +constants 000000000 001111000 +constants 000000001 000101100 +constants 000000001 000101100 +constants 000000000 001111000 diff --git a/src/systemc/tests/systemc/misc/stars/star114477/test.cpp b/src/systemc/tests/systemc/misc/stars/star114477/test.cpp new file mode 100644 index 000000000..6d67240d8 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114477/test.cpp @@ -0,0 +1,71 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#ifdef RTL +#include "design_rtl.h" +#else +#include "design.h" +#endif + +int sc_main(int ac, char *av[]) +{ + // Signals + sc_signal<bool> clk; + sc_signal<sc_bv<9> > out_a0, out_a1; + sc_signal<int> count; + + fun c_block("fun_block"); + c_block.clk(clk); + c_block.count(count); + c_block.out_a0(out_a0); + c_block.out_a1(out_a1); + + sc_start(0, SC_NS); + + count = 0; + + for(int i = 0; i < 10; i++){ + clk.write(1); + sc_start( 5, SC_NS ); + clk.write(0); + sc_start( 5, SC_NS ); + count = count + 1; + cout << "constants " << out_a0 << "\t" << out_a1 << endl; + } + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114566/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114566/golden/test.log new file mode 100644 index 000000000..06d98f903 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114566/golden/test.log @@ -0,0 +1,9 @@ +SystemC Simulation + +Warning: (W212) sc_logic value 'X' cannot be converted to bool +In file: <removed by verify.pl> + +Warning: (W211) sc_logic value 'Z' cannot be converted to bool +In file: <removed by verify.pl> +01ZX +7 diff --git a/src/systemc/tests/systemc/misc/stars/star114566/test.cpp b/src/systemc/tests/systemc/misc/stars/star114566/test.cpp new file mode 100644 index 000000000..4e28fde3c --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114566/test.cpp @@ -0,0 +1,49 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_lv<4> a = "01ZX"; + sc_uint<4> b = a; + cout << a << endl; + cout << b << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114633/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114633/golden/test.log new file mode 100644 index 000000000..4b4b49112 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114633/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +0000 diff --git a/src/systemc/tests/systemc/misc/stars/star114633/test.cpp b/src/systemc/tests/systemc/misc/stars/star114633/test.cpp new file mode 100644 index 000000000..c2a52cc5a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114633/test.cpp @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Dec/18/00 ulrich + +Assignment on an integer to an sc_lv results in an core dump for SystemC 1.0.1 +using SC5.0 on Solaris. It works fine with gcc, though. +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + int i =0; + sc_lv<4> lv4; + + lv4 = i; + cout << lv4 << "\n"; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114639/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114639/golden/test.log new file mode 100644 index 000000000..6d243dcc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114639/golden/test.log @@ -0,0 +1 @@ +SystemC Simulation diff --git a/src/systemc/tests/systemc/misc/stars/star114639/test.cpp b/src/systemc/tests/systemc/misc/stars/star114639/test.cpp new file mode 100644 index 000000000..5317afa50 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114639/test.cpp @@ -0,0 +1,49 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_signal <sc_lv<4> > tmp; + + sc_clock clk( "clk" ); + sc_start( 100, SC_NS ); + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114678/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114678/golden/test.log new file mode 100644 index 000000000..6d243dcc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114678/golden/test.log @@ -0,0 +1 @@ +SystemC Simulation diff --git a/src/systemc/tests/systemc/misc/stars/star114678/test.cpp b/src/systemc/tests/systemc/misc/stars/star114678/test.cpp new file mode 100644 index 000000000..2a13a0256 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114678/test.cpp @@ -0,0 +1,84 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Dec/19/00 ulrich + +Assignment to a bit-slice of an sc_bv, even with an sc_bv with proper size, does not +compile on Solaris SC5.0. It works for gcc, though. + +It works for sc_int and sc_bigint on both compilers. + + +I am using SystemC 1.0.1 (someone **PLEASE** add 1.0.1 to the Stellar list of release!) + +Example: +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_bv<8> bv8 = 3; + sc_bv<4> bv4 = 3; + sc_int<8> i8 = 3; + sc_int<4> i4 = 3; + sc_bigint<8> bi8=3; + sc_bigint<4> bi4=3; + + // OK + bi8.range(5,2) = bi4.range(3,0); + bi8.range(5,2) = bi4; + bi8.range(5,2) = 3; + bi8.range(5,2) = (sc_bigint<4>(3)).range(3,0); + + // OK + i8.range(5,2) = i4.range(3,0); + i8.range(5,2) = i4; + i8.range(5,2) = 3; + i8.range(5,2) = (sc_int<4>(3)).range(3,0); + + + // OK + bv8.range(5,2) = bv4.range(3,0); + + // OK gcc, error SC5.0 + bv8.range(5,2) = bv4; + bv8.range(5,2) = (sc_bv<4>(3)).range(3,0); + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star114716/golden/test.log b/src/systemc/tests/systemc/misc/stars/star114716/golden/test.log new file mode 100644 index 000000000..b575d26ea --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114716/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +1 diff --git a/src/systemc/tests/systemc/misc/stars/star114716/test.cpp b/src/systemc/tests/systemc/misc/stars/star114716/test.cpp new file mode 100644 index 000000000..db256625e --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star114716/test.cpp @@ -0,0 +1,72 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Dec/20/00 ulrich + +I am using SystemC 1.0.1 + +This example causes some really ugly warnings when compiled with Solaris SC5.0. +Please note that there are actually 3 time more warnings than the one below. +Although the simulation result is correct, all these warnings make my hair stand up +and I wonder what I did wrong in my application code. + +It works fine with gcc. +*/ + +#include "systemc.h" + +int sc_main(int argc, char* arg[]) +{ + sc_bv<8> bv8 = 3; + int i; + + // gcc: OK + // SC5.0: works but strange warnings: + // "/home/pumba0/systemc-1.0.1/include/sc_bit_proxies.h", line 169: + // Warning: bv hides sc_bv_ns::sc_range<sc_bv_ns::sc_bv_base>::bv. + // "/home/pumba0/systemc-1.0.1/include/sc_proxy.h", line 487: + // Where: While instantiating "sc_bv_ns::sc_range<sc_bv_ns::sc_bv_base> + // ::sc_range(sc_bv_ns::sc_bv_base&, unsigned, unsigned)". + // "/home/pumba0/systemc-1.0.1/include/sc_proxy.h", line 487: + // Where: Instantiated from non-template code. + i = (bv8.range(4, 1)).to_uint(); + + cout << i << "\n"; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star115038/golden/test.log b/src/systemc/tests/systemc/misc/stars/star115038/golden/test.log new file mode 100644 index 000000000..d439cbfbc --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star115038/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation +00000000000000000000000000001010 +00000000000000000000000000001010 diff --git a/src/systemc/tests/systemc/misc/stars/star115038/test.cpp b/src/systemc/tests/systemc/misc/stars/star115038/test.cpp new file mode 100644 index 000000000..5f42c2810 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star115038/test.cpp @@ -0,0 +1,67 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Jan/4/00 ulrich + +In SystemC 1.0.1: +Conversion (via assignment or constructor) from an integer to sc_lv<32> is broken +on Sun SC5.0. I think it's an endless recursion. + +It works fine with gcc. + +Example: +*/ + +#include "systemc.h" + +int sc_main(int argc, char* arg[]) +{ + int a; + sc_lv<32> b; + a=10; + + b=a; // core dump + cout << b << endl; + b=sc_lv<32>(a); // core dump + cout << b << endl; + + return 0; +} + + + diff --git a/src/systemc/tests/systemc/misc/stars/star115165/golden/test.log b/src/systemc/tests/systemc/misc/stars/star115165/golden/test.log new file mode 100644 index 000000000..352ed734d --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star115165/golden/test.log @@ -0,0 +1,6 @@ +SystemC Simulation +0 s + +Error: (E525) wait(n) is only valid for n > 0: n = 0 +In file: <removed by verify.pl> +In process: a.main_action @ 0 s diff --git a/src/systemc/tests/systemc/misc/stars/star115165/test.cpp b/src/systemc/tests/systemc/misc/stars/star115165/test.cpp new file mode 100644 index 000000000..2f6ec6ef2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star115165/test.cpp @@ -0,0 +1,71 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +SC_MODULE( mod_a ) +{ + sc_in_clk clk; + + void main_action() + { + while( true ) { + cout << sc_time_stamp() << endl; + // wait( 1 ); // fine + wait( 0 ); + } + } + + SC_CTOR( mod_a ) + { + SC_CTHREAD( main_action, clk.pos() ); + } +}; + +int +sc_main( int, char*[] ) +{ + sc_clock clk; + + mod_a a( "a" ); + + a.clk( clk ); + + sc_start( 20, SC_NS ); + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star116072/golden/test.log b/src/systemc/tests/systemc/misc/stars/star116072/golden/test.log new file mode 100644 index 000000000..365b390f1 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star116072/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +sc_bit(1).to_char() = 1 diff --git a/src/systemc/tests/systemc/misc/stars/star116072/test.cpp b/src/systemc/tests/systemc/misc/stars/star116072/test.cpp new file mode 100644 index 000000000..af11c83af --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star116072/test.cpp @@ -0,0 +1,57 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Please compile the program below with SC5.0. The output of the program is: + +sc_bit(1).to_char() = ` + +where the last char in the line is a caro in my shell. It should be + +sc_bit(1).to_char() = 1 +*/ + + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_report_handler::set_actions("/IEEE_Std_1666/deprecated", SC_DO_NOTHING); + cout << "sc_bit(1).to_char() = " << sc_bit(1).to_char() << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star116406/golden/test.log b/src/systemc/tests/systemc/misc/stars/star116406/golden/test.log new file mode 100644 index 000000000..f071f84bf --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star116406/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +a = 4 diff --git a/src/systemc/tests/systemc/misc/stars/star116406/test.cpp b/src/systemc/tests/systemc/misc/stars/star116406/test.cpp new file mode 100644 index 000000000..dc3b5e75b --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star116406/test.cpp @@ -0,0 +1,53 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +The following testcase runs on gcc but crashes with SC5.0: +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_int<8> a = 5; + + a = 12 & a; + + cout << "a = " << a << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star116568/golden/test.log b/src/systemc/tests/systemc/misc/stars/star116568/golden/test.log new file mode 100644 index 000000000..0612092dd --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star116568/golden/test.log @@ -0,0 +1,4 @@ +SystemC Simulation +00000001 +00000010 +00000011 diff --git a/src/systemc/tests/systemc/misc/stars/star116568/test.cpp b/src/systemc/tests/systemc/misc/stars/star116568/test.cpp new file mode 100644 index 000000000..422fb6cd4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star116568/test.cpp @@ -0,0 +1,97 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> + + +SC_MODULE(xyz) { + + sc_in<sc_int<8> > A; + sc_out<sc_lv<8> > X; + + void convert(const sc_lv<8>& I, sc_int<8>& O) { + O=I; + } + + void convert2(const sc_int<8>& I, sc_lv<8>& O) { + O=I; + } + + void entry() { + sc_int<8> tmp; + sc_lv<8> tmp2; + + convert(sc_lv<8>(A.read()),tmp); + convert2(tmp,tmp2); + X.write(tmp2); + } + + SC_CTOR(xyz) { + SC_METHOD(entry); + sensitive << A; + } +}; + + +#define NS * 1e-9 + +int sc_main(int ac, char *av[]) +{ + //Signals + sc_signal<sc_int<8> > A; + sc_signal<sc_lv<8> > X; + + xyz UUT("UUT"); + UUT.A(A); + UUT.X(X); + + sc_start(0, SC_NS); + + A.write(1); + sc_start( 10, SC_NS ); + cout << X.read() << endl; + + A.write(2); + sc_start( 10, SC_NS ); + cout << X.read() << endl; + + A.write(3); + sc_start( 10, SC_NS ); + cout << X.read() << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star117831/golden/test.log b/src/systemc/tests/systemc/misc/stars/star117831/golden/test.log new file mode 100644 index 000000000..21365d22b --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star117831/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +11010001 diff --git a/src/systemc/tests/systemc/misc/stars/star117831/test.cpp b/src/systemc/tests/systemc/misc/stars/star117831/test.cpp new file mode 100644 index 000000000..1b2672b64 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star117831/test.cpp @@ -0,0 +1,66 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Mar/9/01 ulrich + +This is SystemC version 1.0.1 + +The concat or comma operator "(,)" doesn't work for sc_bv on Solaris +SC5.0. It works fine with g++ though. +*/ + +#include <systemc.h> + +int sc_main(int argc, char* arg[]) +{ + sc_bv<4> a("1101"), b("0001"); + sc_bv<8> c; + + c = (a,b); + + // OK with g++ + // + // Error with SC5.0: + // Cannot assign sc_bv_ns::sc_concat<sc_bv_ns::sc_bv_base, sc_bv_ns::sc_bv_base> + // to sc_bv_ns::sc_bv<8> without + // "sc_bv_ns::sc_bv<8>::operator=(const sc_bv_ns::sc_bv<8>&)";. + + cout << c << "\n"; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star123845/golden/test.log b/src/systemc/tests/systemc/misc/stars/star123845/golden/test.log new file mode 100644 index 000000000..88d04ac4a --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star123845/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation + +Info: (I704) VCD delta cycle tracing with pseudo timesteps (1 unit): 1 ps diff --git a/src/systemc/tests/systemc/misc/stars/star123845/test.cpp b/src/systemc/tests/systemc/misc/stars/star123845/test.cpp new file mode 100644 index 000000000..190a65cb3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star123845/test.cpp @@ -0,0 +1,55 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// test for star 123845 + +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + sc_clock clk( "clk" ); + + sc_trace_file* tf = sc_create_vcd_trace_file( "foobar" ); + sc_trace( tf, clk, "clock" ); + sc_trace_delta_cycles( tf, true ); + + sc_start( 100, SC_NS ); + sc_close_vcd_trace_file( tf ); + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star124010/golden/test.log b/src/systemc/tests/systemc/misc/stars/star124010/golden/test.log new file mode 100644 index 000000000..2e7758ea1 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star124010/golden/test.log @@ -0,0 +1,4 @@ +SystemC Simulation +4 +-1 +0 diff --git a/src/systemc/tests/systemc/misc/stars/star124010/test.cpp b/src/systemc/tests/systemc/misc/stars/star124010/test.cpp new file mode 100644 index 000000000..67cb46902 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star124010/test.cpp @@ -0,0 +1,56 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// test of sc_dt::sc_string_old's pos() method -- star 124010 + +#ifdef SC_USE_STD_STRING +# undef SC_USE_STD_STRING +#endif +#define SC_USE_SC_STRING_OLD +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + sc_dt::sc_string_old a( "aap noot mies" ); + + cout << a.pos( "noot" ) << endl; + cout << a.pos( "not" ) << endl; + cout << a.pos( "" ) << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star125338/golden/test.log b/src/systemc/tests/systemc/misc/stars/star125338/golden/test.log new file mode 100644 index 000000000..3681df549 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125338/golden/test.log @@ -0,0 +1,5 @@ +SystemC Simulation +-5 +5 +4294967291 +5 diff --git a/src/systemc/tests/systemc/misc/stars/star125338/test.cpp b/src/systemc/tests/systemc/misc/stars/star125338/test.cpp new file mode 100644 index 000000000..1760641e7 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125338/test.cpp @@ -0,0 +1,60 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// test for star 125338 + +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + sc_bigint<32> x; + sc_biguint<32> y; + sc_int<10> a = -5; + sc_uint<10> b = 5; + + x = a; + cout << x << endl; + x = b; + cout << x << endl; + y = a; + cout << y << endl; + y = b; + cout << y << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star125412/golden/test.log b/src/systemc/tests/systemc/misc/stars/star125412/golden/test.log new file mode 100644 index 000000000..f892f5148 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125412/golden/test.log @@ -0,0 +1,11 @@ +SystemC Simulation +main thread at time 10 ns +main thread at time 20 ns +main thread at time 30 ns +main thread at time 40 ns +main thread at time 50 ns +main thread at time 60 ns +main thread at time 70 ns +main thread at time 80 ns +main thread at time 90 ns +main thread at time 100 ns diff --git a/src/systemc/tests/systemc/misc/stars/star125412/test.cpp b/src/systemc/tests/systemc/misc/stars/star125412/test.cpp new file mode 100644 index 000000000..9d8e17f14 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125412/test.cpp @@ -0,0 +1,119 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +I believe there is a bug in SystemC 2.0 beta 1 which +causes simulation to end prematurely in certain cases. +Specifically, if an event notification occurs at a particular +time but no processes are ready to run at that time, +simulation will end. However, there may still be processes +that need to be run at future times. + +Below I've included an example which demonstrates the bug, +and below that I've provided a proposed fix for the bug. + +// This SystemC 2.0 example shows the bug... +*/ + +#include <systemc.h> + +class top : public sc_module +{ + public: + SC_HAS_PROCESS(top); + + top(sc_module_name name) : sc_module(name) + { + SC_THREAD(main); + } + + void main() + { + sc_event e; + + // comment out the following line to see bug go away + + e.notify(55, SC_NS); + + for (int i = 0; i < 10; i++) + { + wait(10, SC_NS); + cout << "main thread at time " << sc_time_stamp() << endl; + } + } +}; + +int sc_main (int argc , char *argv[]) +{ + top top1("Top1"); + sc_start(); + return 0; +} + +/* +/////// End of example + +The proposed fix for this in SystemC 2.0 beta 1 is: + +Edit src/sysc/kernel/sc_simcontext.cpp + +Lines 801-802, which read: + +// no more runnable processes +break; + +Should be changed to read: + +// no runnable processes at current time, but maybe in future +t = next_time(); +continue; + +The same changes should be applied at lines 845-846 +Then rebuild and reinstall the SystemC library. + + +___________________________________________________ +Stuart Swan, Senior Architect +System Level Design Group, Cadence Design Systems +Building 11 +2670 Seely Avenue +San Jose, CA 95134 +Phone: +1 408 895 4579 +Email: stuart@cadence.com +___________________________________________________ + +*/ diff --git a/src/systemc/tests/systemc/misc/stars/star125422/golden/test.log b/src/systemc/tests/systemc/misc/stars/star125422/golden/test.log new file mode 100644 index 000000000..8b59b28a2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125422/golden/test.log @@ -0,0 +1,7 @@ +SystemC Simulation +0 s +15 ns +30 ns +45 ns +60 ns +75 ns diff --git a/src/systemc/tests/systemc/misc/stars/star125422/test.cpp b/src/systemc/tests/systemc/misc/stars/star125422/test.cpp new file mode 100644 index 000000000..6f67fb70d --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125422/test.cpp @@ -0,0 +1,54 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// test of simulate_until by calling sc_start mutiple times + +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + sc_clock clk( "clk", 20, SC_NS ); + + for( int i = 0; i < 5; ++ i ) { + cout << sc_time_stamp() << endl; + sc_start( 15, SC_NS ); + } + cout << sc_time_stamp() << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star125788/golden/test.log b/src/systemc/tests/systemc/misc/stars/star125788/golden/test.log new file mode 100644 index 000000000..318d65ef3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125788/golden/test.log @@ -0,0 +1,40 @@ +SystemC Simulation +8 +9 +10 +11 + +8 +9 +10 +11 + +8 +9 +10 +11 + +8 +9 +10 +11 + +8 +9 +10 +11 + +8 +9 +10 +11 + +8 +9 +10 +11 + +8 +9 +10 +11 diff --git a/src/systemc/tests/systemc/misc/stars/star125788/test.cpp b/src/systemc/tests/systemc/misc/stars/star125788/test.cpp new file mode 100644 index 000000000..9d5729b09 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star125788/test.cpp @@ -0,0 +1,149 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Please add support in form of constructors and assigment operators +such that assigments between types sc_int, sc_uint, sc_bigint, sc_biguint +work in all cases. Currently, assigning a sc_int or sc_uint does not +work in most cases. + +The following test case shows were things don't work. I tried it with +g++ 2.92.5 and Sun SC6.1 on Solaris. +*/ + +#include <systemc.h> + +int sc_main( int, char*[] ) +{ + sc_int<8> i8 = 8; + sc_uint<9> u9 = 9; + sc_bigint<10> bi10 = 10; + sc_biguint<11> bu11 = 11; + + sc_int<8> i8_2; + sc_uint<9> u9_2; + sc_bigint<10> bi10_2; + sc_biguint<11> bu11_2; + + i8_2 = sc_int<8>(i8); + cout << i8_2 << endl; + i8_2 = sc_int<8>(u9); // g++ 2.95.2: ambiguous + cout << i8_2 << endl; + i8_2 = sc_int<8>(bi10); + cout << i8_2 << endl; + i8_2 = sc_int<8>(bu11); + cout << i8_2 << endl; + + cout << endl; + + u9_2 = sc_uint<9>(i8); // g++ 2.95.2: ambiguous + cout << u9_2 << endl; + u9_2 = sc_uint<9>(u9); + cout << u9_2 << endl; + u9_2 = sc_uint<9>(bi10); + cout << u9_2 << endl; + u9_2 = sc_uint<9>(bu11); + cout << u9_2 << endl; + + cout << endl; + + bi10_2 = sc_bigint<10>(i8); + cout << bi10_2 << endl; + bi10_2 = sc_bigint<10>(u9); + cout << bi10_2 << endl; + bi10_2 = sc_bigint<10>(bi10); + cout << bi10_2 << endl; + bi10_2 = sc_bigint<10>(bu11); + cout << bi10_2 << endl; + + cout << endl; + + bu11_2 = sc_biguint<11>(i8); // g++ 2.95.2: ambiguous, SC6.1: error + cout << bu11_2 << endl; + bu11_2 = sc_biguint<11>(u9); // g++ 2.95.2: ambiguous, SC6.1: error + cout << bu11_2 << endl; + bu11_2 = sc_biguint<11>(bi10); + cout << bu11_2 << endl; + bu11_2 = sc_biguint<11>(bu11); + cout << bu11_2 << endl; + + cout << endl; + + i8_2 = i8; + cout << i8_2 << endl; + i8_2 = u9; + cout << i8_2 << endl; + i8_2 = bi10; + cout << i8_2 << endl; + i8_2 = bu11; + cout << i8_2 << endl; + + cout << endl; + + u9_2 = i8; + cout << u9_2 << endl; + u9_2 = u9; + cout << u9_2 << endl; + u9_2 = bi10; + cout << u9_2 << endl; + u9_2 = bu11; + cout << u9_2 << endl; + + cout << endl; + + bi10_2 = i8; + cout << bi10_2 << endl; + bi10_2 = u9; + cout << bi10_2 << endl; + bi10_2 = bi10; + cout << bi10_2 << endl; + bi10_2 = bu11; + cout << bi10_2 << endl; + + cout << endl; + + bu11_2 = i8; + cout << bu11_2 << endl; + bu11_2 = u9; + cout << bu11_2 << endl; + bu11_2 = bi10; + cout << bu11_2 << endl; + bu11_2 = bu11; + cout << bu11_2 << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star126360/golden/test.log b/src/systemc/tests/systemc/misc/stars/star126360/golden/test.log new file mode 100644 index 000000000..1f4fa7045 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star126360/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/stars/star126360/test.cpp b/src/systemc/tests/systemc/misc/stars/star126360/test.cpp new file mode 100644 index 000000000..7cc84cb68 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star126360/test.cpp @@ -0,0 +1,71 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// test of sc_stop() inside end_of_elaboration() + +#include "systemc.h" + +SC_MODULE( mod_a ) +{ + sc_in_clk clk; + + void main_action() + { + cout << "main_action\n"; + } + + SC_CTOR( mod_a ) + { + SC_METHOD( main_action ); + sensitive << clk.pos(); + } + + virtual void end_of_elaboration() + { + sc_stop(); + } +}; + +int +sc_main( int, char*[] ) +{ + sc_clock clk; + mod_a a("a"); + a.clk( clk ); + sc_start( 100, SC_NS ); + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star127536/golden/test.log b/src/systemc/tests/systemc/misc/stars/star127536/golden/test.log new file mode 100644 index 000000000..9cc4e2a49 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127536/golden/test.log @@ -0,0 +1,32 @@ +SystemC Simulation + +Info: (I804) /IEEE_Std_1666/deprecated: deprecated function: sc_set_default_time_unit +5 ns: trigger1 : 0 +6 ns: trigger2 : 0 +15 ns: trigger1 : 1 +16 ns: trigger2 : 1 +25 ns: trigger1 : 2 +26 ns: trigger2 : 2 +35 ns: trigger1 : 3 +36 ns: trigger2 : 3 +45 ns: trigger1 : 4 +46 ns: trigger2 : 4 +55 ns: trigger1 : 5 +56 ns: trigger2 : 5 +65 ns: trigger1 : 6 +66 ns: trigger2 : 6 +75 ns: trigger1 : 7 +76 ns: trigger2 : 7 +85 ns: trigger1 : 8 +86 ns: trigger2 : 8 +95 ns: trigger1 : 9 +96 ns: trigger2 : 9 +finishing at 100 ns + +Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about + IEEE 1666 deprecated features by placing this method call + as the first statement in your sc_main() function: + + sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", + sc_core::SC_DO_NOTHING ); + diff --git a/src/systemc/tests/systemc/misc/stars/star127536/test.cpp b/src/systemc/tests/systemc/misc/stars/star127536/test.cpp new file mode 100644 index 000000000..58ac9941c --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127536/test.cpp @@ -0,0 +1,129 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Hello, + +sorry for asking again about the sc_start/sc_cycle problem but... + +The following program causes trouble (SystemC V2.0b2): +*/ + +#include "systemc.h" + +SC_MODULE(createpulse) + { + public: + sc_in_clk i_clk; + private: + int trigger1,trigger2; + void pulse() + { + while(true) + { + wait(); + cout << sc_time_stamp() << ": trigger1 : " <<trigger1++ << endl; + wait(1,SC_NS); + cout << sc_time_stamp() << ": trigger2 : " <<trigger2++ << endl; + } + } + public: + SC_CTOR(createpulse) + { + SC_THREAD(pulse); + sensitive << i_clk.pos(); + trigger1 = 0; + trigger2 = 0; + } + }; + +// createpulse dut("testpulse"); + +int sc_main(int argc, char *argv[]) + { + int i; + sc_trace_file *tf; + sc_signal<bool> clk1; + + sc_set_time_resolution(1,SC_NS); + sc_set_default_time_unit(1,SC_NS); + + // sc_clock dummy( "dummy", 2, SC_NS ); + + createpulse dut("testpulse"); + + dut.i_clk(clk1); // see other posting + + tf=sc_create_vcd_trace_file("vcdtrace"); + sc_trace(tf,clk1,"clock"); + + // sc_initialize(); // comment out for sc_start version + for(i=0;i<10;i++) + { + clk1=0; + // sc_cycle(5,SC_NS); // change to sc_start + sc_start( 5, SC_NS ); + clk1=1; + // sc_cycle(5,SC_NS); // change to sc_start + sc_start( 5, SC_NS ); + } + + cout << "finishing at " << sc_time_stamp() << endl; + sc_close_vcd_trace_file(tf); + + return(EXIT_SUCCESS); + } + +/* +With this programm, the clk1 is generated as can be seen in the trace file. +But the pulse procedure gets stuck in the second wait function. With SystemC +V1.x, this worked with replacing sc_cycle with sc_start (and removing the +sc_initialize), however calling sc_start multiple was an undocumented feature +and it doesnt work in V2.0b2 (no clk is generated). +I know that this problem can be solved by creating an own clock generation +module using wait()s and just a single sc_start in sc_main, but IMHO +sometimes it is desirable to do it the way shown above. So is this possible +with SystemC V2.0 ? + +Regards, Sven Heithecker + +-- +Sven Heithecker IDA, Hans-Sommer-Str. 66 +Technical University of Braunschweig 38106 Braunschweig +Tel. +49-(0)531-391-3751(voice)/4587(fax) Germany +http://www.ida.ing.tu-bs.de/~svenh heithecker@ida.ing.tu-bs.de +*/ diff --git a/src/systemc/tests/systemc/misc/stars/star127624/golden/test.log b/src/systemc/tests/systemc/misc/stars/star127624/golden/test.log new file mode 100644 index 000000000..515454b33 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127624/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation +15 +7 diff --git a/src/systemc/tests/systemc/misc/stars/star127624/test.cpp b/src/systemc/tests/systemc/misc/stars/star127624/test.cpp new file mode 100644 index 000000000..484c56b9c --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127624/test.cpp @@ -0,0 +1,57 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_uint<3> ia; + sc_uint<1> ib; + sc_uint<4> ic; + + ia = 7; + ib = 1; + ic = ( ia[2] & ib, ia ); + cout << ic << endl; + + ib = 0; + ic = ( ia[2] & ib, ia ); + cout << ic << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star127712/golden/test.log b/src/systemc/tests/systemc/misc/stars/star127712/golden/test.log new file mode 100644 index 000000000..34c5fb6d4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127712/golden/test.log @@ -0,0 +1,6 @@ +SystemC Simulation +0 s: Method Activated +0 s: Method Activated +1 ns: Method Activated +2 ns: Method Activated +3 ns: Method Activated diff --git a/src/systemc/tests/systemc/misc/stars/star127712/test.cpp b/src/systemc/tests/systemc/misc/stars/star127712/test.cpp new file mode 100644 index 000000000..af918b25d --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127712/test.cpp @@ -0,0 +1,108 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +If a process is sensitive to sc_port<some_if<T>, N> and +this port is bind to two signals, the process is responding +to only the events on first signal, it's not responding to +events on second (or other) signals. it seems to me as a +bug. how to resolve this problem?? + +Thanks in advance, +kiran + +when i run the following program i got this output. +0: Method Activated +0: Method Activated +3: Method Activated + +but expected output is, +0: Method Activated +0: Method Activated +1: Method Activated +2: Method Activated +3: Method Activated +*/ + +#include "systemc.h" + +SC_MODULE(tst) { + sc_port<sc_signal_in_if<bool>, 2> INP; + + void print_mthd() { + cout <<sc_time_stamp()<<": Method Activated"<<endl; + } + + SC_CTOR(tst) { + SC_METHOD(print_mthd); + sensitive << INP; + } +}; + +int sc_main(int argc, char* argv[]) { + + sc_signal<bool> INP1, INP2; + + tst tsti("tsti"); + tsti.INP(INP1); + tsti.INP(INP2); + + sc_start(0, SC_NS); + + INP1.write(1); + sc_start(1, SC_NS); + INP2.write(1); + sc_start(1, SC_NS); + INP2.write(0); + sc_start(1, SC_NS); + INP1.write(0); + sc_start(1, SC_NS); + + return 0; +} + + +/* +===== +M.N.V.Satya Kiran,M.Tech +Project Trainee, ED&T Synthesis, +Building: WAY- 3.24, +Phone: +31-40-2743924. +NatLab-Philips Research Laboratories, +Prof.Holstlaan 4, 5656 AA Eindhoven, +The Netherlands. +*/ diff --git a/src/systemc/tests/systemc/misc/stars/star127848/golden/test.log b/src/systemc/tests/systemc/misc/stars/star127848/golden/test.log new file mode 100644 index 000000000..2438e7a97 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127848/golden/test.log @@ -0,0 +1,8 @@ +SystemC Simulation +11001100 +01100 +00110 +11100110 +11100110 +10110011 +10110011 diff --git a/src/systemc/tests/systemc/misc/stars/star127848/test.cpp b/src/systemc/tests/systemc/misc/stars/star127848/test.cpp new file mode 100644 index 000000000..9be8fe1c5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127848/test.cpp @@ -0,0 +1,64 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_bv<8> foo = "11001100"; + cout << foo << endl; + sc_bv<5> a = foo.range( 4, 0 ); + sc_bv<5> b = foo.range( 0, 4 ); + cout << a << endl; + cout << b << endl; + + sc_bv<8> bar = foo; + foo.range( 0, 6 ) = foo.range( 1, 7 ); + cout << foo << endl; + foo = bar; + foo.range( 6, 0 ) = foo.range( 7, 1 ); + cout << foo << endl; + foo = bar; + foo.range( 0, 6 ) = foo.range( 7, 1 ); + cout << foo << endl; + foo = bar; + foo.range( 6, 0 ) = foo.range( 1, 7 ); + cout << foo << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star127914/golden/test.log b/src/systemc/tests/systemc/misc/stars/star127914/golden/test.log new file mode 100644 index 000000000..9e20fd3c9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127914/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +sum is 5 diff --git a/src/systemc/tests/systemc/misc/stars/star127914/test.cpp b/src/systemc/tests/systemc/misc/stars/star127914/test.cpp new file mode 100644 index 000000000..3b4c93910 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star127914/test.cpp @@ -0,0 +1,66 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +When I do an sc_biguint + sc_int addition, then the +code is compiled fine but links fails because the +operator was never defined. + +This happens with SystemC 1.0.2 on Solaris with both +gcc and Sun SC compiler. +*/ + +#include <systemc.h> + +int sc_main(int, char**) +{ + sc_int<8> i8; + sc_biguint<8> bu8; + + i8=2; + bu8=3; + bu8 = bu8 + i8; + cout << "sum is " << bu8 << "\n"; + + return 0; +} + +/* +Undefined first referenced + symbol in file +operator+(sc_unsigned const &, sc_int_base const &)str.o +*/ diff --git a/src/systemc/tests/systemc/misc/stars/star129901/golden/test.log b/src/systemc/tests/systemc/misc/stars/star129901/golden/test.log new file mode 100644 index 000000000..b575d26ea --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star129901/golden/test.log @@ -0,0 +1,2 @@ +SystemC Simulation +1 diff --git a/src/systemc/tests/systemc/misc/stars/star129901/test.cpp b/src/systemc/tests/systemc/misc/stars/star129901/test.cpp new file mode 100644 index 000000000..5e9a8c5a9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star129901/test.cpp @@ -0,0 +1,81 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +I found this while trying to improve coverage of the SystemC regression tests. + +Compile the following program, bug.cpp, with + +g++ -g -I /u/scp/src/systemc-2.0/include bug.cpp /u/scp/src/systemc-2.0/lib-gccsparcOS5/libsystemc.a +(in mountain view, elsewhere use SYSTEMC_HOME pointing to the 2.0 release) + +------------------------------------------------------------------------------- +*/ + +#define SC_INCLUDE_FX 1 +#include "systemc.h" + +double bug() +{ + sc_fxval_fast fast(2); + sc_fxval slow(1); + fast = slow; + fast += slow; + fast -= slow; + fast *= slow; + fast /= slow; + return fast.to_double(); +} + +int sc_main(int, char*[]) +{ + cout << bug() << endl; + return 0; +} + +/* +------------------------------------------------------------------------------- +It fails to link, giving the message + +Undefined first referenced + symbol in file +sc_fxval_fast::operator+=(sc_fxval const &) /var/tmp/ccNbIiHN.o +sc_fxval_fast::operator-=(sc_fxval const &) /var/tmp/cclXNLsO.o +sc_fxval_fast::operator/=(sc_fxval const &) /var/tmp/cclXNLsO.o +sc_fxval_fast::operator*=(sc_fxval const &) /var/tmp/cclXNLsO.o +*/ + diff --git a/src/systemc/tests/systemc/misc/stars/star130782/golden/test.log b/src/systemc/tests/systemc/misc/stars/star130782/golden/test.log new file mode 100644 index 000000000..d6cee7b36 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star130782/golden/test.log @@ -0,0 +1,16 @@ +SystemC Simulation +A = 0x000000000000000000000000000000000 +Y = 0x000000000000000000000000000000000 + +A = 0x0ffffffffffffffffffffffffffffffff +B = 00000 +Y = 0x0ffffffffffffffffffffffffffffffff + +A = 0x000000000000000000000000000000000 +B = 00000 +Y = 0x000000000000000000000000000000000 + +A = 0x000000000000000000000000000000000 +B = 00000 +Y = 0x000000000000000000000000000000000 + diff --git a/src/systemc/tests/systemc/misc/stars/star130782/test.cpp b/src/systemc/tests/systemc/misc/stars/star130782/test.cpp new file mode 100644 index 000000000..8d28c00bc --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star130782/test.cpp @@ -0,0 +1,138 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Subject: range() of sc_biguint +From: "Masahiro Taniguchi" <taniguchi.masahiro@lsi.melco.co.jp> +Date: Mon, 12 Nov 2001 16:29:04 +0900 +To: "systemc-forum" <systemc-forum@systemc.org> + +Hi all, + +I found a strange simulation result regarding sc_biguint. +I attached the example about it. +The example described 3 case. + 1. Write non-0 + 2. Write 0 without cast + 3. Write 0 with cast (sc_biguint<8>) +The wrong result appears in the 2nd case. +Is this a bug of SystemC? + +-------Environment------- + SystemC V1.0.2 and V2.0 + GCC 2.95.2 + Sun Solaris +------------------------- + +Regards, + +Masahiro Taniguchi +Mitsubishi Electric Corporation +JAPAN + +------------------------------------------------------------ +*/ + +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + int i; + int index0,index1; + sc_biguint<128> A; + sc_uint<16> B; + sc_biguint<128> Y; + + A = 0; + Y = 0; + cout << "A = " << A.to_string(SC_HEX) << endl; + cout << "Y = " << Y.to_string(SC_HEX) << endl << endl; + + // 1st Case + A = "0xffffffffffffffffffffffffffffffff"; + B = 0; + + for(i=15;i>=0;i--) + { + index0 = 8*(i+1)-1; + index1 = 8* i; + if(B[i] == 0) { + Y.range(index0,index1) = A.range(index0,index1); + } + } + + cout << "A = " << A.to_string(SC_HEX) << endl; + cout << "B = " << hex << B << endl; + cout << "Y = " << Y.to_string(SC_HEX) << endl << endl; + + // 2nd Case + A = 0; + B = 0; + + for(i=15;i>=0;i--) + { + index0 = 8*(i+1)-1; + index1 = 8* i; + if(B[i] == 0) { + Y.range(index0,index1) = A.range(index0,index1); + } + } + + cout << "A = " << A.to_string(SC_HEX) << endl; + cout << "B = " << hex << B << endl; + cout << "Y = " << Y.to_string(SC_HEX) << endl << endl; + + // 3rd Case + A = 0; + B = 0; + + for(i=15;i>=0;i--) + { + index0 = 8*(i+1)-1; + index1 = 8* i; + if(B[i] == 0) { + Y.range(index0,index1) = (sc_biguint<8>)A.range(index0,index1); + } + } + + cout << "A = " << A.to_string(SC_HEX) << endl; + cout << "B = " << hex << B << endl; + cout << "Y = " << Y.to_string(SC_HEX) << endl << endl; + + return(0); +} diff --git a/src/systemc/tests/systemc/misc/stars/star130786/golden/test.log b/src/systemc/tests/systemc/misc/stars/star130786/golden/test.log new file mode 100644 index 000000000..7fd18a00e --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star130786/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation +a = 10 +a = 10 diff --git a/src/systemc/tests/systemc/misc/stars/star130786/test.cpp b/src/systemc/tests/systemc/misc/stars/star130786/test.cpp new file mode 100644 index 000000000..fcebd8d1e --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star130786/test.cpp @@ -0,0 +1,102 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// +// Demo Code for SystemC 2.0 Casting Problem +// +// Rob Slater +// Motorola, Inc. +// r.slater@motorola.com +// +// +// Compile this file with: +// g++ -Wall +// (use g++ version 2.95.2) +// +// With SystemC 1.0.2 the file compiles and prints +// "a = 10" to stdout. +// +// With SystemC 2.0 (release) line 32 fails compilation +// with the error: +// sc_main.cc:32: `const class sc_uint<16>' used where a `unsigned int' was expected +// + +#include <systemc.h> + +// sc_uint<16> unused; + +SC_MODULE(Test) +{ + sc_in_clk clk; + sc_in<sc_uint<16> > in; + + void meth() + { + unsigned int a; + + a = in.read(); + cout << "a = " << a << endl; + + } // meth() + + SC_CTOR(Test) + { + SC_METHOD(meth); + sensitive << clk.pos(); + + } // SC_CTOR(Test) + +}; // SC_MODULE(Test) + + +int sc_main(int argc, char *argv[]) +{ + // Declare the clock + sc_clock clk("clk", 50, SC_NS, 0.5, 0, SC_NS, false); + + sc_signal<sc_uint<16> > in; + + Test test("test"); + test.clk(clk); + test.in(in); + + in.write(10); // Initialize "in" with "10" + sc_start(75, SC_NS); // Run for 1-1/2 clock cycles + + return 0; + +} // sc_main() diff --git a/src/systemc/tests/systemc/misc/stars/star132075/golden/test.log b/src/systemc/tests/systemc/misc/stars/star132075/golden/test.log new file mode 100644 index 000000000..5052222ac --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star132075/golden/test.log @@ -0,0 +1,9 @@ +SystemC Simulation +1 +1 +0 +0 +1 +1 +0 +0 diff --git a/src/systemc/tests/systemc/misc/stars/star132075/test.cpp b/src/systemc/tests/systemc/misc/stars/star132075/test.cpp new file mode 100644 index 000000000..57b4ff3b5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star132075/test.cpp @@ -0,0 +1,75 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Dec/6/01 ulrich + +Comparison of bit-slices of sc_int and sc_uint vectors +does not work due to ambiguity. See example below. +It does work with sc_bigint, however. +*/ + +#include <systemc.h> + +int sc_main(int, char**) +{ + { + // sc_biguint<32> a,b; + sc_uint<32> a,b; + a=15; + b=45; + + cout << (a.range(5,2) < b.range(5,2)) << "\n"; + cout << (a.range(5,2) <= b.range(5,2)) << "\n"; + cout << (a.range(5,2) > b.range(5,2)) << "\n"; + cout << (a.range(5,2) >= b.range(5,2)) << "\n"; + } + + { + // sc_bigint<32> a,b; + sc_int<32> a,b; + a=15; + b=45; + + cout << (a.range(5,2) < b.range(5,2)) << "\n"; + cout << (a.range(5,2) <= b.range(5,2)) << "\n"; + cout << (a.range(5,2) > b.range(5,2)) << "\n"; + cout << (a.range(5,2) >= b.range(5,2)) << "\n"; + } + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star132136/golden/test.log b/src/systemc/tests/systemc/misc/stars/star132136/golden/test.log new file mode 100644 index 000000000..6d243dcc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star132136/golden/test.log @@ -0,0 +1 @@ +SystemC Simulation diff --git a/src/systemc/tests/systemc/misc/stars/star132136/test.cpp b/src/systemc/tests/systemc/misc/stars/star132136/test.cpp new file mode 100644 index 000000000..9e651f6b1 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star132136/test.cpp @@ -0,0 +1,70 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* + Assignment of an integer to a bit-slice of a bit-vector + works fine for sc_[u]int, sc_bug[u]int but not sc_bv + and sc_lv. That's very strange, especially since it + it allowed to assign an integer to the entire sc_bv/sc_lv + vector. The error message from SC6.1 is + + no match for `sc_bv_ns::sc_range<sc_bv_ns::sc_lv_base> = int &' + + Example: +*/ + +#include <systemc.h> + +int sc_main(int, char**) +{ + sc_int<32> i; + sc_uint<32> u; + sc_bigint<32> bi; + sc_biguint<32> bu; + sc_lv<32> lv; + sc_bv<32> bv; + int I = 42; + + i.range(14,1) = I; + u.range(14,1) = I; + bi.range(14,1) = I; + bu.range(14,1) = I; + lv.range(14,1) = I; // ERROR + bv.range(14,1) = I; // ERROR + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star133377/golden/test.log b/src/systemc/tests/systemc/misc/stars/star133377/golden/test.log new file mode 100644 index 000000000..88fbca79c --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star133377/golden/test.log @@ -0,0 +1,11 @@ +SystemC Simulation +sc_int (1) 0b1110101111101011 +sc_int (2) 0b1110101110111011 +sc_uint (1) 0b01110101111101011 +sc_uint (2) 0b01110101110111011 +sc_bigint (2) 0b1110101110111011 +sc_biguint (2) 0b01110101110111011 +sc_bv (1) 1110101111101011 +sc_bv (2) 1110101110111011 +sc_lv (1) 1110101111101011 +sc_lv (2) 1110101110111011 diff --git a/src/systemc/tests/systemc/misc/stars/star133377/test.cpp b/src/systemc/tests/systemc/misc/stars/star133377/test.cpp new file mode 100644 index 000000000..f7555e06d --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star133377/test.cpp @@ -0,0 +1,130 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char**) +{ + { // sc_int works fine + sc_int<8> a; + sc_int<16> x; + a=sc_bigint<8>("0b11101011"); + + x=(a,a); + cout << "sc_int (1) " << sc_bigint<16>(x).to_string(SC_BIN) << endl; + + x=(a.range(7,0), a.range(3,0), a.range(3,0)); + cout << "sc_int (2) " + << sc_bigint<16>(x).to_string(SC_BIN) << endl; + } + { // sc_uint works fine + sc_uint<8> a; + sc_uint<16> x; + a=sc_biguint<8>("0b11101011"); + + x=(a,a); + cout << "sc_uint (1) " << sc_biguint<16>(x).to_string(SC_BIN) << endl; + + x=(a.range(7,0), a.range(3,0), a.range(3,0)); + cout << "sc_uint (2) " + << sc_biguint<16>(x).to_string(SC_BIN) << endl; + } + { + sc_bigint<8> a; + sc_bigint<16> x; + a="0b11101011"; + + // compile error (SC6.1): + // Error: Overloading ambiguity between "operator,(const sc_uint_base&, const sc_uint_base&)" + // and "operator,(const sc_int_base&, const sc_int_base&)". + // Error: Overloading ambiguity between "sc_bigint<16>::operator=(const sc_uint_base&)" + // and "sc_bigint<16>::operator=(long long)". + // ---- + // x=(a,a); + // cout << "sc_bigint (1) " << x.to_string(SC_BIN) << endl; + + // runtime error: concat yields wrong result + // returned value is 1111111111111011 + // but should be 1110101110111011 + x=(a.range(7,0), a.range(3,0), a.range(3,0)); + cout << "sc_bigint (2) "<< x.to_string(SC_BIN) << endl; + } + { + sc_biguint<8> a; + sc_biguint<16> x; + a="0b11101011"; + + // compile error (SC6.1): + // Error: Overloading ambiguity between "operator,(const sc_uint_base&, const sc_uint_base&)" + // and "operator,(const sc_int_base&, const sc_int_base&)". + // Error: Overloading ambiguity between "sc_bigint<16>::operator=(const sc_uint_base&)" + // and "sc_bigint<16>::operator=(long long)". + // ---- + // x=(a,a); + // cout << "sc_biguint (1) " << x.to_string(SC_BIN) << endl; + + // runtime error: concat yields wrong result + // returned value is 0000000000001011 + // but should be 1110101110111011 + x=(a.range(7,0), a.range(3,0), a.range(3,0)); + cout << "sc_biguint (2) " << x.to_string(SC_BIN) << endl; + } + { // sc_bv works fine + sc_bv<8> a; + sc_bv<16> x; + a="11101011"; + + x=(a,a); + cout << "sc_bv (1) " << x.to_string() << endl; + + x=(a.range(7,0), a.range(3,0), a.range(3,0)); + cout << "sc_bv (2) " << x.to_string() << endl; + } + { // sc_lv works fine + sc_lv<8> a; + sc_lv<16> x; + a="11101011"; + + x=(a,a); + cout << "sc_lv (1) " << x.to_string() << endl; + + x=(a.range(7,0), a.range(3,0), a.range(3,0)); + cout << "sc_lv (2) " << x.to_string() << endl; + } + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star135771/golden/test.log b/src/systemc/tests/systemc/misc/stars/star135771/golden/test.log new file mode 100644 index 000000000..f928eb5b3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star135771/golden/test.log @@ -0,0 +1,3 @@ +SystemC Simulation +01ZX0000111101ZX +111101ZXXXXXXXXX diff --git a/src/systemc/tests/systemc/misc/stars/star135771/test.cpp b/src/systemc/tests/systemc/misc/stars/star135771/test.cpp new file mode 100644 index 000000000..eeffdc138 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star135771/test.cpp @@ -0,0 +1,75 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +/* +Hi, + +Im using SystemC 2.0b2 with gcc 2.95.3 (Linux). If I create an sc_lv +assignment with range methods on every side like + +lv1.range(15,8) = lv2.range(7,0); + +and the lv2 vector contains "z", I get the warning message + +WARNING: (E2004) sc_bv cannot contain values X and Z : + - ../../../../../src/sysc/datatypes/bit/sc_bv.h: 340 + +and the assignment is not done. Further investigation revealed that the +vector seems to get mistakenly converted to a sc_bv in between. Removing the +range method on one side or adding a cast + +lv1.range(15,8) = (sc_lv<8>)lv2.range(7,0); + +solves that problem. + +Regards, S. Heithecker +*/ + +#include "systemc.h" + +int +sc_main( int, char*[] ) +{ + sc_lv<16> a( "01ZX0000111101ZX" ); + sc_lv<16> b; + + b.range( 15, 8 ) = a.range( 7, 0 ); + cout << a << endl; + cout << b << endl; + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/star137040/golden/test.log b/src/systemc/tests/systemc/misc/stars/star137040/golden/test.log new file mode 100644 index 000000000..3511464d9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star137040/golden/test.log @@ -0,0 +1,5 @@ +SystemC Simulation +10 +10 +6 +6 diff --git a/src/systemc/tests/systemc/misc/stars/star137040/test.cpp b/src/systemc/tests/systemc/misc/stars/star137040/test.cpp new file mode 100644 index 000000000..a119df1ba --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star137040/test.cpp @@ -0,0 +1,57 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-03-22 + + *****************************************************************************/ + +/***************************************************************************** + + 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, char*[] ) +{ + sc_uint<5> a = 10; + const sc_uint<5> b = 10; + + sc_uint<5> x = ( a[2], a[4], a[3], a[1], a[0] ); + + sc_uint<5> y = ( b[2], b[4], b[3], b[1], b[0] ); + + cout << a << endl; + cout << b << endl; + cout << x << endl; + cout << y << endl; + + return 0; +} + diff --git a/src/systemc/tests/systemc/misc/stars/vcd_trace/star126273/golden/test.vcd b/src/systemc/tests/systemc/misc/stars/vcd_trace/star126273/golden/test.vcd new file mode 100644 index 000000000..0f16ae536 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/vcd_trace/star126273/golden/test.vcd @@ -0,0 +1,49 @@ + +$timescale + 1 ps +$end + +$scope module SystemC $end +$var wire 1 aaaaa clk1 $end +$var wire 1 aaaab clk2 $end +$upscope $end +$enddefinitions $end + +$comment +All initial values are dumped below at time 0 sec = 0 timescale units. +$end + +$dumpvars +0aaaaa +0aaaab +$end + +#3000 +1aaaab + +#5000 +1aaaaa + +#9000 +0aaaab + +#10000 +0aaaaa + +#15000 +1aaaaa +1aaaab + +#20000 +0aaaaa + +#21000 +0aaaab + +#25000 +1aaaaa + +#27000 +1aaaab + +#30000 diff --git a/src/systemc/tests/systemc/misc/stars/vcd_trace/star126273/test.cpp b/src/systemc/tests/systemc/misc/stars/vcd_trace/star126273/test.cpp new file mode 100644 index 000000000..be8f38566 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/vcd_trace/star126273/test.cpp @@ -0,0 +1,124 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// +// bug in sc_vcd_trace::cycle() +// in SystemC 1.2.1Beta (also 1.0.2). +// Simulates correctly (two clock edges at time 15). +// But VCD is corrupt - has #0 instead of #15. +// Also, this message should be printed but isn't: +// VCD Trace Warning: +// Multiple cycles found with same (15) time units count. +// Waveform viewers will only show the states of the last one. +// Use ((vcd_trace_file*)vcdfile)->sc_set_vcd_time_unit(int exponent10_seconds) +// to increase time resolution. +// +// + +#include "systemc.h" +// #include <iostream.h> + +// class foo: sc_module { +class foo: public sc_module { +public: + sc_in<bool> clk1; + sc_in<bool> clk2; + + SC_CTOR(foo) { + SC_METHOD(do_clk1); + sensitive << clk1.pos(); + SC_METHOD(do_clk2); + sensitive << clk2.pos(); + } + void do_clk1() { + cout << "foo: clk1 + " << sc_time_stamp() << endl; + } + void do_clk2() { + cout << "foo: clk2 + " << sc_time_stamp() << endl; + } +}; + +int +sc_main(int argc, char *argv[]) +{ + // sc_clock clk1("clk1", 10, SC_NS, 0.5); + // sc_clock clk2("clk2", 12, SC_NS, 0.5); + sc_signal<bool> clk1( "clk1" ); + sc_signal<bool> clk2( "clk2" ); + + foo FOO("FOO"); + + FOO.clk1(clk1); + FOO.clk2(clk2); + + sc_trace_file *tf = sc_create_vcd_trace_file("test"); + // sc_trace(tf, clk1.signal(), "clk1"); + // sc_trace(tf, clk2.signal(), "clk2"); + sc_trace(tf, clk1, "clk1"); + sc_trace(tf, clk2, "clk2"); + + sc_start(0, SC_NS); + + clk1 = 0; + clk2 = 0; // 0 ns + sc_start(3, SC_NS); + clk2 = 1; // 3 ns + + sc_start(2, SC_NS); + clk1 = 1; // 5 ns + + sc_start(4, SC_NS); + clk2 = 0; // 9 ns + sc_start(1, SC_NS); + clk1 = 0; // 10 ns + sc_start(5, SC_NS); + clk2 = 1; // 15 ns + + sc_start(0, SC_NS); + clk1 = 1; // 15 ns + + sc_start(5, SC_NS); + clk1 = 0; // 20 ns + sc_start(1, SC_NS); + clk2 = 0; // 21 ns + sc_start(4, SC_NS); + clk1 = 1; // 25 ns + + sc_start(2, SC_NS); + clk2 = 1; // 27 ns + + sc_start(3, SC_NS); + clk1 = 0; // 30 ns + + sc_close_vcd_trace_file(tf); + + return 0; +} diff --git a/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/flop.h b/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/flop.h new file mode 100644 index 000000000..77990cf12 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/flop.h @@ -0,0 +1,63 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + flop.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "systemc.h" + +SC_MODULE(flop) +{ + sc_in_clk clk; + sc_in<sc_uint<1> > in; + sc_out<sc_uint<1> > out; + + SC_CTOR(flop) { + SC_CTHREAD(entry,clk.pos() ); + } + + void entry(); +}; + + +// #include "flop.h" + +void flop::entry() +{ + while (true) { + out = in; + wait(); +}; +} + diff --git a/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/golden/test.awif b/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/golden/test.awif new file mode 100644 index 000000000..fec891c67 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/golden/test.awif @@ -0,0 +1,312 @@ + +type scalar "BIT" enum '0', '1' ; +type scalar "MVL" enum '0', '1', 'X', 'Z', '?' ; + +declare O0 "clk" BIT variable ; +start_trace O0 ; +declare O1 "int1" BIT 0 0 variable ; +start_trace O1 ; +declare O2 "int2" BIT 0 0 variable ; +start_trace O2 ; +comment "All initial values are dumped below at time 0 sec = 0 timescale units." ; +assign O0 '1' ; +assign O1 "0" ; +assign O2 "0" ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + +delta_time 10000 ; +assign O0 '1' ; + +delta_time 10000 ; +assign O0 '0' ; + diff --git a/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/test.cpp b/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/test.cpp new file mode 100644 index 000000000..220710a4c --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/wif_trace/star115332/test.cpp @@ -0,0 +1,76 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + test.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "flop.h" +#include "systemc.h" + + +int sc_main(int argc, char *argv[]) //(int ac, char** av) + +{ + + sc_signal<sc_uint<1> > int1 ; + sc_signal<sc_uint<1> > int2 ; + + + sc_clock clk("clk", 20, SC_NS, 0.5); + + + +// instanciate Processes + + flop FLOP("flip_flop"); + FLOP.clk(clk) ; + FLOP.in(int1) ; + FLOP.out(int2) ; + + sc_trace_file * tf = sc_create_wif_trace_file("test"); + sc_trace( tf, clk, "clk"); + sc_trace( tf, int1, "int1"); + sc_trace( tf, int2, "int2"); + + /* + sc_trace_file * tf2 = sc_create_vcd_trace_file("dump_vcd"); + sc_trace( tf2, clk, "clk"); + sc_trace( tf2, int1, "int1"); + sc_trace( tf2, int2, "int2"); + */ + + sc_start(1000, SC_NS); + sc_close_wif_trace_file( tf ); + return 0; +} |