00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <boost/test/unit_test.hpp>
00020 #include "torc/physical/OutputStreamHelpers.hpp"
00021 #include "torc/physical/Factory.hpp"
00022 #include <sstream>
00023
00024 namespace torc {
00025 namespace physical {
00026
00027 BOOST_AUTO_TEST_SUITE(physical)
00028
00029
00030
00031 BOOST_AUTO_TEST_CASE(OutputStreamHelpersUnitTest) {
00032 std::stringstream s;
00033
00034
00035
00036 std::string designName = "blinker";
00037 std::string deviceName = "xc5vlx30";
00038 std::string devicePackage = "ff324";
00039 std::string deviceSpeedGrade = "-1";
00040 std::string xdlVersion = "v3.2";
00041 DesignSharedPtr designPtr = Factory::newDesignPtr(designName, deviceName, devicePackage,
00042 deviceSpeedGrade, xdlVersion);
00043 s << *designPtr;
00044 BOOST_CHECK_EQUAL(s.str(), "blinker [xc5vlx30ff324-1, v3.2]");
00045 s.str(std::string());
00046
00047
00048
00049 std::string moduleName = "osc7";
00050 std::string moduleAnchor = "x0y0";
00051 ModuleSharedPtr modulePtr = Factory::newModulePtr(moduleName, moduleAnchor);
00052 s << *modulePtr;
00053 BOOST_CHECK_EQUAL(s.str(), "osc7 [x0y0]");
00054 s.str(std::string());
00055
00056
00057
00058 std::string instanceName = "blink";
00059 std::string instanceType = "SLICEL";
00060 std::string instanceTile = "CLBLL_X16Y59";
00061 std::string instanceSite = "SLICE_X27Y59";
00062 InstanceSharedPtr instancePtr = Factory::newInstancePtr(instanceName, instanceType,
00063 instanceTile, instanceSite);
00064 s << *instancePtr;
00065 BOOST_CHECK_EQUAL(s.str(), "blink");
00066 s.str(std::string());
00067
00068
00069
00070 std::string netName = "blink";
00071 ENetType netType = eNetTypeNormal;
00072 NetSharedPtr netPtr = Factory::newNetPtr(netName, netType);
00073 s << *netPtr;
00074 BOOST_CHECK_EQUAL(s.str(), "blink");
00075 s.str(std::string());
00076
00077
00078
00079 std::string pinName = "DQ";
00080 InstancePinSharedPtr instancePinPtr = Factory::newInstancePinPtr(instancePtr, pinName);
00081 s << *instancePinPtr;
00082 BOOST_CHECK_EQUAL(s.str(), "blink.DQ");
00083 s.str(std::string());
00084
00085
00086
00087 std::string pipTile = "CLBLL_X16Y59";
00088 std::string pipSource = "L_DQ";
00089 std::string pipSink = "SITE_LOGIC_OUTS3";
00090 EPipDirection pipDirection = ePipUnidirectionalBuffered;
00091 Pip pip = Factory::newPip(pipTile, pipSource, pipSink, pipDirection);
00092 s << pip;
00093 BOOST_CHECK_EQUAL(s.str(), "CLBLL_X16Y59 L_DQ -> SITE_LOGIC_OUTS3");
00094 s.str(std::string());
00095
00096
00097
00098 std::string configName = "blink";
00099 std::string configValue = "#FF";
00100 Config config(configName, configValue);
00101 s << config;
00102 BOOST_CHECK_EQUAL(s.str(), "blink:#FF");
00103 s.str(std::string());
00104 }
00105
00106 BOOST_AUTO_TEST_SUITE_END()
00107
00108 }
00109 }