diff options
Diffstat (limited to 'src/systemc/tests/systemc/misc/sim_tests/tri_state2')
11 files changed, 560 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/display.cpp b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/display.cpp new file mode 100644 index 000000000..a60ae744f --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/display.cpp @@ -0,0 +1,47 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + display.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: + + *****************************************************************************/ + +/* Filename display.cc */ +/* This is the implementation file for asynchronous process `display' */ + +#include "display.h" + +void display::entry() +{ + cout << "Value on Bus = " << bus.read() << endl; +} // end of entry function + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/display.h b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/display.h new file mode 100644 index 000000000..47cb1ae04 --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/display.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + display.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: + + *****************************************************************************/ + +/* Filename display.h */ +/* This is the interface file for asynchronous process `display' */ + +#include "systemc.h" + +SC_MODULE( display ) +{ + SC_HAS_PROCESS( display ); + + const sc_signal_resolved& bus; //input + + // Constructor + display( sc_module_name NAME, + const sc_signal_resolved& BUS ) + : bus(BUS) + { + SC_METHOD( entry ); + sensitive << bus; + } + + // Process functionality in member function below + void entry(); +}; + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/driver.cpp b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/driver.cpp new file mode 100644 index 000000000..797de03cd --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/driver.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. + + *****************************************************************************/ + +/***************************************************************************** + + driver.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: + + *****************************************************************************/ + +/* Filename driver.cc */ +/* This is the implementation file for synchronous process `driver' */ + +#include "driver.h" + +void driver::entry() +{ + control.write(true); + out.write(false); + wait(); + cout << "Input is = " << in.read() << endl; + + control.write(false); + wait(); + cout << "Input is = " << in.read() << endl; + + control.write(true); + out.write(true); + wait(); + cout << "Input is = " << in.read() << endl; + + control.write(false); + wait(); + cout << "Input is = " << in.read() << endl; + sc_stop(); +} // end of entry function + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/driver.h b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/driver.h new file mode 100644 index 000000000..2d82b1d3e --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/driver.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. + + *****************************************************************************/ + +/***************************************************************************** + + driver.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: + + *****************************************************************************/ + +/* Filename driver.h */ +/* This is the interface file for synchronous process `driver' */ + +#include "systemc.h" + +SC_MODULE( driver ) +{ + SC_HAS_PROCESS( driver ); + + sc_in_clk clk; + + const sc_signal_resolved& in; //input + sc_out<bool> control; + sc_out<bool> out; + + // Constructor + driver( sc_module_name NAME, + sc_clock& CLK, + const sc_signal_resolved& IN1, + sc_signal<bool>& CONTROL, + sc_signal<bool>& OUT1 ) + : in(IN1) + { + clk(CLK); + control(CONTROL); + out(OUT1); + SC_CTHREAD( entry, clk.pos() ); + } + + // Process functionality in member function below + void entry(); +}; + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/golden/tri_state2.log b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/golden/tri_state2.log new file mode 100644 index 000000000..c559095d5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/golden/tri_state2.log @@ -0,0 +1,10 @@ +SystemC Simulation +Value on Bus = X +Value on Bus = Z +Value on Bus = X +Input is = X +Input is = X +Input is = X +Input is = X + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/main.cpp b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/main.cpp new file mode 100644 index 000000000..82b85ece4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/main.cpp @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + main.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: + + *****************************************************************************/ + +/* Main routine for tri-state simulation */ + +#include "driver.h" +#include "ts_buf.h" +#include "pullup.h" +#include "display.h" + +int sc_main(int ac, char* av[] ) +{ + sc_signal_resolved bus; + sc_signal<bool> control; + sc_signal<bool> out; + + sc_clock clock("CLK", 10.0, SC_NS, 0.5, 0.0, SC_NS); + + driver D("Driver", clock, bus, control, out); + ts_buf B("Buffer", out, control, bus); + pullup P("BusPullup", clock, bus); + display DISP("BusDisplay", bus); + + sc_start(200, SC_NS); + + return 0; +} + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/pullup.cpp b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/pullup.cpp new file mode 100644 index 000000000..e4729a6ec --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/pullup.cpp @@ -0,0 +1,50 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + pullup.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: + + *****************************************************************************/ + +/* Filename pullup.cc */ +/* This is the implementation file for synchronous process `pullup' */ + +#include "pullup.h" + +void pullup::entry() +{ + while (true) { + pup.write(sc_logic('H')); + wait(); + } +} // end of entry function + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/pullup.h b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/pullup.h new file mode 100644 index 000000000..1bf4a4aad --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/pullup.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + pullup.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: + + *****************************************************************************/ + +/* Filename pullup.h */ +/* This is the interface file for synchronous process `pullup' */ + +#include "systemc.h" + +SC_MODULE( pullup ) +{ + SC_HAS_PROCESS( pullup ); + + sc_in_clk clk; + + sc_signal_resolved& pup; //output + + // Constructor + pullup( sc_module_name NAME, + sc_clock& CLK, + sc_signal_resolved& PUP ) + : pup(PUP) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + // Process functionality in member function below + void entry(); +}; + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/tri_state2.f b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/tri_state2.f new file mode 100644 index 000000000..963470209 --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/tri_state2.f @@ -0,0 +1,5 @@ +tri_state2/display.cpp +tri_state2/driver.cpp +tri_state2/main.cpp +tri_state2/pullup.cpp +tri_state2/ts_buf.cpp diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/ts_buf.cpp b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/ts_buf.cpp new file mode 100644 index 000000000..85e56dc48 --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/ts_buf.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. + + *****************************************************************************/ + +/***************************************************************************** + + ts_buf.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: + + *****************************************************************************/ + +/* Filename ts_buf.cc */ +/* This is the implementation file for asynchronous process `ts_buf' */ + +#include "ts_buf.h" + +void ts_buf::entry() +{ + bool c; + bool bus_val; + sc_logic val; + + c = control.read(); + + if (c == false) { + ts_out.write(sc_logic('Z')); + } + else { + bus_val = in.read(); + val = bus_val; // automatic type conversion + ts_out.write(val); + } +} // end of entry function + diff --git a/src/systemc/tests/systemc/misc/sim_tests/tri_state2/ts_buf.h b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/ts_buf.h new file mode 100644 index 000000000..29ecb6f3e --- /dev/null +++ b/src/systemc/tests/systemc/misc/sim_tests/tri_state2/ts_buf.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + ts_buf.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: + + *****************************************************************************/ + +/* Filename ts_buf.h */ +/* This is the interface file for asynchronous process `ts_buf' */ + +#include "systemc.h" + +SC_MODULE( ts_buf ) +{ + SC_HAS_PROCESS( ts_buf ); + + sc_in<bool> in; + sc_in<bool> control; + sc_signal_resolved& ts_out; //output + + // Constructor + ts_buf( sc_module_name NAME, + sc_signal<bool>& IN1, + sc_signal<bool>& CONTROL, + sc_signal_resolved& TS_OUT ) + : ts_out(TS_OUT) + { + in(IN1); + control(CONTROL); + SC_METHOD( entry ); + sensitive << in << control; + } + + // Process functionality in member function below + void entry(); +}; + |