3 #include "netlist_test_utils.h" 
    4 #include "gate_library_test_utils.h" 
   15             test_utils::init_log_channels();
 
   16             test_utils::create_sandbox_directory();
 
   21             test_utils::remove_sandbox_directory();
 
   42             std::string netlist_input(
"-- Device\t: device_name\n" 
   44                                     "use IEEE.STD_LOGIC_1164.ALL;\n" 
   46                                     "use SIMPRIM.VCOMPONENTS.ALL;\n" 
   47                                     "use SIMPRIM.VPKG.ALL;\n" 
   49                                     "entity TEST_Comp is\n" 
   51                                     "    net_global_in : in STD_LOGIC := 'X';\n" 
   52                                     "    net_global_out : out STD_LOGIC := 'X';\n" 
   56                                     "architecture STRUCTURE of TEST_Comp is\n" 
   57                                     "  signal net_0 : STD_LOGIC;\n" 
   58                                     "  signal net_1 : STD_LOGIC;\n" 
   62                                     "      I => net_global_in,\n" 
   67                                     "      I0 => net_global_in,\n" 
   68                                     "      I1 => net_global_in,\n" 
   75                                     "      O => net_global_out\n" 
   80             std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
   83             ASSERT_TRUE(nl_res.is_ok());
 
   84             std::unique_ptr<Netlist> nl = nl_res.get();
 
   85             ASSERT_NE(nl, 
nullptr);
 
   88             EXPECT_EQ(nl->get_design_name(), 
"TEST_Comp");
 
   91             ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"BUF")).size(), 1);
 
   92             Gate* gate_0 = *(nl->get_gates(test_utils::gate_type_filter(
"BUF")).begin());
 
   93             ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"AND2")).size(), 1);
 
   94             Gate* gate_1 = *(nl->get_gates(test_utils::gate_type_filter(
"AND2")).begin());
 
   95             ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"AND3")).size(), 1);
 
   96             Gate* gate_2 = *(nl->get_gates(test_utils::gate_type_filter(
"AND3")).begin());
 
   98             ASSERT_NE(gate_0, 
nullptr);
 
   99             EXPECT_EQ(gate_0->
get_name(), 
"gate_0");
 
  101             ASSERT_NE(gate_1, 
nullptr);
 
  102             EXPECT_EQ(gate_1->
get_name(), 
"gate_1");
 
  104             ASSERT_NE(gate_2, 
nullptr);
 
  105             EXPECT_EQ(gate_2->
get_name(), 
"gate_2");
 
  108             Net* net_0 = *(nl->get_nets(test_utils::net_name_filter(
"net_0")).begin());
 
  109             Net* net_1 = *(nl->get_nets(test_utils::net_name_filter(
"net_1")).begin());
 
  110             Net* net_global_in = *(nl->get_nets(test_utils::net_name_filter(
"net_global_in")).begin());
 
  112                 net_global_out = *(nl->get_nets(test_utils::net_name_filter(
"net_global_out")).begin());
 
  114             ASSERT_NE(net_0, 
nullptr);
 
  115             EXPECT_EQ(net_0->
get_name(), 
"net_0");
 
  117             EXPECT_EQ(net_0->
get_sources()[0], test_utils::get_endpoint(gate_0, 
"O"));
 
  118             std::vector<Endpoint*> exp_net_0_dsts = {test_utils::get_endpoint(gate_2, 
"I0")};
 
  120                                                               std::vector<Endpoint*>({test_utils::get_endpoint(gate_2,
 
  123             ASSERT_NE(net_1, 
nullptr);
 
  124             EXPECT_EQ(net_1->
get_name(), 
"net_1");
 
  126             EXPECT_EQ(net_1->
get_sources()[0], test_utils::get_endpoint(gate_1, 
"O"));
 
  128                                                               std::vector<Endpoint*>({test_utils::get_endpoint(gate_2,
 
  131             ASSERT_NE(net_global_in, 
nullptr);
 
  132             EXPECT_EQ(net_global_in->
get_name(), 
"net_global_in");
 
  135                                                               std::vector<Endpoint*>({test_utils::get_endpoint(gate_0,
 
  137                                                                                       test_utils::get_endpoint(gate_1,
 
  139                                                                                       test_utils::get_endpoint(gate_1,
 
  141             EXPECT_TRUE(nl->is_global_input_net(net_global_in));
 
  143             ASSERT_NE(net_global_out, 
nullptr);
 
  144             EXPECT_EQ(net_global_out->
get_name(), 
"net_global_out");
 
  145             ASSERT_EQ(net_global_out->
get_sources().size(), 1);
 
  146             EXPECT_EQ(net_global_out->
get_sources()[0], test_utils::get_endpoint(gate_2, 
"O"));
 
  148             EXPECT_TRUE(nl->is_global_output_net(net_global_out));
 
  150             EXPECT_EQ(nl->get_global_input_nets().size(), 1);
 
  151             EXPECT_EQ(nl->get_global_output_nets().size(), 1);
 
  165                 std::string netlist_input(
"-- Device\t: device_name\n" 
  166                                         "library IEEE;use IEEE.STD_LOGIC_1164.ALL;library SIMPRIM;\n" 
  167                                         "use SIMPRIM.VCOMPONENTS.ALL;use SIMPRIM.VPKG.ALL;\n" 
  168                                         "entity TEST_Comp is port(net_global_in:in STD_LOGIC := 'X';net_global_out\n" 
  170                                         " : out STD_LOGIC := 'X';);end TEST_Comp;architecture \n" 
  171                                         " STRUCTURE of TEST_Comp is signal net_0 : STD_LOGIC;\n" 
  172                                         "signal net_1 : STD_LOGIC;\n" 
  173                                         "begin gate_0 : BUF port map(\n" 
  174                                         "  I => net_global_in,\n" 
  179                                         "    port map ( I0 \n\t" 
  180                                         "      => net_global_in\n" 
  182                                         "      I1 => net_global_in,O => net_1);\n" 
  183                                         "gate_2:AND3 port map(I0 => net_0,I1 => net_1,O => net_global_out);end STRUCTURE;");
 
  185                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  188                 ASSERT_TRUE(nl_res.is_ok());
 
  189                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  190                 ASSERT_NE(nl, 
nullptr);
 
  193                 ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"BUF")).size(), 1);
 
  194                 Gate* gate_0 = *(nl->get_gates(test_utils::gate_type_filter(
"BUF")).begin());
 
  195                 ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"AND2")).size(), 1);
 
  196                 Gate* gate_1 = *(nl->get_gates(test_utils::gate_type_filter(
"AND2")).begin());
 
  197                 ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"AND3")).size(), 1);
 
  198                 Gate* gate_2 = *(nl->get_gates(test_utils::gate_type_filter(
"AND3")).begin());
 
  200                 ASSERT_NE(gate_0, 
nullptr);
 
  201                 EXPECT_EQ(gate_0->
get_name(), 
"gate_0");
 
  203                 ASSERT_NE(gate_1, 
nullptr);
 
  204                 EXPECT_EQ(gate_1->
get_name(), 
"gate_1");
 
  206                 ASSERT_NE(gate_2, 
nullptr);
 
  207                 EXPECT_EQ(gate_2->
get_name(), 
"gate_2");
 
  210                 Net* net_0 = *(nl->get_nets(test_utils::net_name_filter(
"net_0")).begin());
 
  211                 Net* net_1 = *(nl->get_nets(test_utils::net_name_filter(
"net_1")).begin());
 
  213                     net_global_in = *(nl->get_nets(test_utils::net_name_filter(
"net_global_in")).begin());
 
  215                     net_global_out = *(nl->get_nets(test_utils::net_name_filter(
"net_global_out")).begin());
 
  217                 ASSERT_NE(net_0, 
nullptr);
 
  218                 EXPECT_EQ(net_0->
get_name(), 
"net_0");
 
  220                 EXPECT_EQ(net_0->
get_sources()[0], test_utils::get_endpoint(gate_0, 
"O"));
 
  221                 std::vector<Endpoint*> exp_net_0_dsts = {test_utils::get_endpoint(gate_2, 
"I0")};
 
  223                                                                   std::vector<Endpoint*>({test_utils::get_endpoint(gate_2,
 
  226                 ASSERT_NE(net_1, 
nullptr);
 
  227                 EXPECT_EQ(net_1->
get_name(), 
"net_1");
 
  229                 EXPECT_EQ(net_1->
get_sources()[0], test_utils::get_endpoint(gate_1, 
"O"));
 
  231                                                                   std::vector<Endpoint*>({test_utils::get_endpoint(gate_2,
 
  234                 ASSERT_NE(net_global_in, 
nullptr);
 
  235                 EXPECT_EQ(net_global_in->
get_name(), 
"net_global_in");
 
  238                                                                   std::vector<Endpoint*>({test_utils::get_endpoint(gate_0,
 
  240                                                                                           test_utils::get_endpoint(gate_1,
 
  242                                                                                           test_utils::get_endpoint(gate_1,
 
  244                 EXPECT_TRUE(nl->is_global_input_net(net_global_in));
 
  246                 ASSERT_NE(net_global_out, 
nullptr);
 
  247                 EXPECT_EQ(net_global_out->
get_name(), 
"net_global_out");
 
  248                 ASSERT_EQ(net_global_out->
get_sources().size(), 1);
 
  249                 EXPECT_EQ(net_global_out->
get_sources()[0], test_utils::get_endpoint(gate_2, 
"O"));
 
  251                 EXPECT_TRUE(nl->is_global_output_net(net_global_out));
 
  253                 EXPECT_EQ(nl->get_global_input_nets().size(), 1);
 
  254                 EXPECT_EQ(nl->get_global_output_nets().size(), 1);
 
  270                 std::string netlist_input(
 
  273                                         "       a, b : in STD_LOGIC; " 
  274                                         "       c : out STD_LOGIC; " 
  278                                         "architecture top_arch of top is " 
  298                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  301                 ASSERT_TRUE(nl_res.is_ok());
 
  302                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  303                 ASSERT_NE(nl, 
nullptr);
 
  305                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).size(), 1);
 
  306                 Gate* gate_0 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).front();
 
  311                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).size(), 1);
 
  312                 Gate* gate_1 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).front();
 
  317                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).size(), 1);
 
  318                 Gate* gate_2 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).front();
 
  326                 std::string netlist_input(
 
  329                                         "       a, b : in STD_LOGIC; " 
  330                                         "       c : out STD_LOGIC; " 
  334                                         "architecture top_arch of top is " 
  357                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  360                 ASSERT_TRUE(nl_res.is_ok());
 
  361                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  362                 ASSERT_NE(nl, 
nullptr);
 
  364                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).size(), 1);
 
  365                 Gate* gate_0 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).front();
 
  370                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).size(), 1);
 
  371                 Gate* gate_1 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).front();
 
  376                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).size(), 1);
 
  377                 Gate* gate_2 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).front();
 
  385                 std::string netlist_input(
 
  388                                         "       a, b : in STD_LOGIC; " 
  389                                         "       c : out STD_LOGIC; " 
  393                                         "architecture top_arch of top is " 
  395                                         "   gate_0 : AND2 port map (a, b, c); " 
  396                                         "   gate_1 : AND2 port map (a, b); " 
  397                                         "   gate_2 : AND2 port map (a); " 
  401                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  404                 ASSERT_TRUE(nl_res.is_ok());
 
  405                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  406                 ASSERT_NE(nl, 
nullptr);
 
  408                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).size(), 1);
 
  409                 Gate* gate_0 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).front();
 
  414                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).size(), 1);
 
  415                 Gate* gate_1 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).front();
 
  420                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).size(), 1);
 
  421                 Gate* gate_2 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).front();
 
  429                 std::string netlist_input(
 
  432                                         "       a, b : in STD_LOGIC; " 
  433                                         "       c : out STD_LOGIC; " 
  437                                         "architecture top_arch of top is " 
  439                                         "   gate_0 : AND2 port map (a, b, c); " 
  440                                         "   gate_1 : AND2 port map (open, b, c); " 
  441                                         "   gate_2 : AND2 port map (open, open, c); " 
  445                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  448                 ASSERT_TRUE(nl_res.is_ok());
 
  449                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  450                 ASSERT_NE(nl, 
nullptr);
 
  452                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).size(), 1);
 
  453                 Gate* gate_0 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_0")).front();
 
  458                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).size(), 1);
 
  459                 Gate* gate_1 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_1")).front();
 
  464                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).size(), 1);
 
  465                 Gate* gate_2 = nl->get_gates(test_utils::gate_filter(
"AND2", 
"gate_2")).front();
 
  473                 std::string netlist_input(
 
  476                                         "       as, bs : in STD_LOGIC; " 
  477                                         "       cs : out STD_LOGIC; " 
  481                                         "architecture sub_arch of sub_mod is " 
  493                                         "       a, b : in STD_LOGIC; " 
  494                                         "       c : out STD_LOGIC; " 
  498                                         "architecture top_arch of top is " 
  518                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  521                 ASSERT_TRUE(nl_res.is_ok());
 
  522                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  523                 ASSERT_NE(nl, 
nullptr);
 
  525                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_0")).size(), 1);
 
  526                 Module* inst_0 = nl->get_modules(test_utils::module_name_filter(
"inst_0")).front();
 
  527                 const auto pins_0 = inst_0->
get_pins();
 
  528                 EXPECT_EQ(pins_0.size(), 3);
 
  529                 EXPECT_EQ(pins_0.at(0)->get_name(), 
"as");
 
  530                 EXPECT_EQ(pins_0.at(0)->get_net()->get_name(), 
"a");
 
  531                 EXPECT_EQ(pins_0.at(1)->get_name(), 
"bs");
 
  532                 EXPECT_EQ(pins_0.at(1)->get_net()->get_name(), 
"b");
 
  533                 EXPECT_EQ(pins_0.at(2)->get_name(), 
"cs");
 
  534                 EXPECT_EQ(pins_0.at(2)->get_net()->get_name(), 
"c");
 
  536                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_1")).size(), 1);
 
  537                 Module* inst_1 = nl->get_modules(test_utils::module_name_filter(
"inst_1")).front();
 
  538                 const auto pins_1 = inst_1->
get_pins();
 
  539                 EXPECT_EQ(pins_1.size(), 2);
 
  540                 EXPECT_EQ(pins_1.at(0)->get_name(), 
"bs");
 
  541                 EXPECT_EQ(pins_1.at(0)->get_net()->get_name(), 
"b");
 
  542                 EXPECT_EQ(pins_1.at(1)->get_name(), 
"cs");
 
  543                 EXPECT_EQ(pins_1.at(1)->get_net()->get_name(), 
"c");
 
  545                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_2")).size(), 1);
 
  546                 Module* inst_2 = nl->get_modules(test_utils::module_name_filter(
"inst_2")).front();
 
  547                 const auto pins_2 = inst_2->
get_pins();
 
  548                 EXPECT_EQ(pins_2.size(), 1);
 
  549                 EXPECT_EQ(pins_2.at(0)->get_name(), 
"cs");
 
  550                 EXPECT_EQ(pins_2.at(0)->get_net()->get_name(), 
"c");
 
  555                 std::string netlist_input(
 
  558                                         "       as, bs : in STD_LOGIC; " 
  559                                         "       cs : out STD_LOGIC; " 
  563                                         "architecture sub_arch of sub_mod is " 
  575                                         "       a, b : in STD_LOGIC; " 
  576                                         "       c : out STD_LOGIC; " 
  580                                         "architecture top_arch of top is " 
  603                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  606                 ASSERT_TRUE(nl_res.is_ok());
 
  607                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  608                 ASSERT_NE(nl, 
nullptr);
 
  610                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_0")).size(), 1);
 
  611                 Module* inst_0 = nl->get_modules(test_utils::module_name_filter(
"inst_0")).front();
 
  612                 const auto pins_0 = inst_0->
get_pins();
 
  613                 EXPECT_EQ(pins_0.size(), 3);
 
  614                 EXPECT_EQ(pins_0.at(0)->get_name(), 
"as");
 
  615                 EXPECT_EQ(pins_0.at(0)->get_net()->get_name(), 
"a");
 
  616                 EXPECT_EQ(pins_0.at(1)->get_name(), 
"bs");
 
  617                 EXPECT_EQ(pins_0.at(1)->get_net()->get_name(), 
"b");
 
  618                 EXPECT_EQ(pins_0.at(2)->get_name(), 
"cs");
 
  619                 EXPECT_EQ(pins_0.at(2)->get_net()->get_name(), 
"c");
 
  621                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_1")).size(), 1);
 
  622                 Module* inst_1 = nl->get_modules(test_utils::module_name_filter(
"inst_1")).front();
 
  623                 const auto pins_1 = inst_1->
get_pins();
 
  624                 EXPECT_EQ(pins_1.size(), 2);
 
  625                 EXPECT_EQ(pins_1.at(0)->get_name(), 
"bs");
 
  626                 EXPECT_EQ(pins_1.at(0)->get_net()->get_name(), 
"b");
 
  627                 EXPECT_EQ(pins_1.at(1)->get_name(), 
"cs");
 
  628                 EXPECT_EQ(pins_1.at(1)->get_net()->get_name(), 
"c");
 
  630                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_2")).size(), 1);
 
  631                 Module* inst_2 = nl->get_modules(test_utils::module_name_filter(
"inst_2")).front();
 
  632                 const auto pins_2 = inst_2->
get_pins();
 
  633                 EXPECT_EQ(pins_2.size(), 1);
 
  634                 EXPECT_EQ(pins_2.at(0)->get_name(), 
"cs");
 
  635                 EXPECT_EQ(pins_2.at(0)->get_net()->get_name(), 
"c");
 
  640                 std::string netlist_input(
 
  643                                         "       as, bs : in STD_LOGIC; " 
  644                                         "       cs : out STD_LOGIC; " 
  648                                         "architecture sub_arch of sub_mod is " 
  650                                         "   gate_0 : AND2 port map (as, bs, cs); " 
  655                                         "       a, b : in STD_LOGIC; " 
  656                                         "       c : out STD_LOGIC; " 
  660                                         "architecture top_arch of top is " 
  662                                         "   inst_0 : sub_mod port map (a, b, c); " 
  663                                         "   inst_1 : sub_mod port map (a, b); " 
  664                                         "   inst_2 : sub_mod port map (a); " 
  668                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  671                 ASSERT_TRUE(nl_res.is_ok());
 
  672                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  673                 ASSERT_NE(nl, 
nullptr);
 
  675                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_0")).size(), 1);
 
  676                 Module* inst_0 = nl->get_modules(test_utils::module_name_filter(
"inst_0")).front();
 
  677                 const auto pins_0 = inst_0->
get_pins();
 
  678                 EXPECT_EQ(pins_0.size(), 3);
 
  679                 EXPECT_EQ(pins_0.at(0)->get_name(), 
"as");
 
  680                 EXPECT_EQ(pins_0.at(0)->get_net()->get_name(), 
"a");
 
  681                 EXPECT_EQ(pins_0.at(1)->get_name(), 
"bs");
 
  682                 EXPECT_EQ(pins_0.at(1)->get_net()->get_name(), 
"b");
 
  683                 EXPECT_EQ(pins_0.at(2)->get_name(), 
"cs");
 
  684                 EXPECT_EQ(pins_0.at(2)->get_net()->get_name(), 
"c");
 
  686                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_1")).size(), 1);
 
  687                 Module* inst_1 = nl->get_modules(test_utils::module_name_filter(
"inst_1")).front();
 
  688                 const auto pins_1 = inst_1->
get_pins();
 
  689                 EXPECT_EQ(pins_1.size(), 2);
 
  690                 EXPECT_EQ(pins_1.at(0)->get_name(), 
"as");
 
  691                 EXPECT_EQ(pins_1.at(0)->get_net()->get_name(), 
"a");
 
  692                 EXPECT_EQ(pins_1.at(1)->get_name(), 
"bs");
 
  693                 EXPECT_EQ(pins_1.at(1)->get_net()->get_name(), 
"b");
 
  695                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_2")).size(), 1);
 
  696                 Module* inst_2 = nl->get_modules(test_utils::module_name_filter(
"inst_2")).front();
 
  697                 const auto pins_2 = inst_2->
get_pins();
 
  698                 EXPECT_EQ(pins_2.size(), 1);
 
  699                 EXPECT_EQ(pins_2.at(0)->get_name(), 
"as");
 
  700                 EXPECT_EQ(pins_2.at(0)->get_net()->get_name(), 
"a");
 
  705                 std::string netlist_input(
"entity sub_mod is " 
  707                                           "       as, bs : in STD_LOGIC; " 
  708                                           "       cs : out STD_LOGIC; " 
  712                                           "architecture sub_arch of sub_mod is " 
  714                                           "   gate_0 : AND2 port map (as, bs, cs); " 
  719                                           "       a, b : in STD_LOGIC; " 
  720                                           "       c : out STD_LOGIC; " 
  724                                           "architecture top_arch of top is " 
  726                                           "   inst_0 : sub_mod port map (a, b, c); " 
  727                                           "   inst_1 : sub_mod port map (open, b, c); " 
  728                                           "   inst_2 : sub_mod port map (open, open, c); " 
  732                 auto vhdl_file              = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  735                 ASSERT_TRUE(nl_res.is_ok());
 
  736                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  737                 ASSERT_NE(nl, 
nullptr);
 
  739                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_0")).size(), 1);
 
  740                 Module* inst_0    = nl->get_modules(test_utils::module_name_filter(
"inst_0")).front();
 
  741                 const auto pins_0 = inst_0->
get_pins();
 
  742                 EXPECT_EQ(pins_0.size(), 3);
 
  743                 EXPECT_EQ(pins_0.at(0)->get_name(), 
"as");
 
  744                 EXPECT_EQ(pins_0.at(0)->get_net()->get_name(), 
"a");
 
  745                 EXPECT_EQ(pins_0.at(1)->get_name(), 
"bs");
 
  746                 EXPECT_EQ(pins_0.at(1)->get_net()->get_name(), 
"b");
 
  747                 EXPECT_EQ(pins_0.at(2)->get_name(), 
"cs");
 
  748                 EXPECT_EQ(pins_0.at(2)->get_net()->get_name(), 
"c");
 
  750                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_1")).size(), 1);
 
  751                 Module* inst_1    = nl->get_modules(test_utils::module_name_filter(
"inst_1")).front();
 
  752                 const auto pins_1 = inst_1->
get_pins();
 
  753                 EXPECT_EQ(pins_1.size(), 2);
 
  754                 EXPECT_EQ(pins_1.at(0)->get_name(), 
"bs");
 
  755                 EXPECT_EQ(pins_1.at(0)->get_net()->get_name(), 
"b");
 
  756                 EXPECT_EQ(pins_1.at(1)->get_name(), 
"cs");
 
  757                 EXPECT_EQ(pins_1.at(1)->get_net()->get_name(), 
"c");
 
  759                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_2")).size(), 1);
 
  760                 Module* inst_2    = nl->get_modules(test_utils::module_name_filter(
"inst_2")).front();
 
  761                 const auto pins_2 = inst_2->
get_pins();
 
  762                 EXPECT_EQ(pins_2.size(), 1);
 
  763                 EXPECT_EQ(pins_2.at(0)->get_name(), 
"cs");
 
  764                 EXPECT_EQ(pins_2.at(0)->get_net()->get_name(), 
"c");
 
  769                 std::string netlist_input(
 
  770                                         "entity sub_sub_mod is " 
  772                                         "       ass, bss : in STD_LOGIC; " 
  773                                         "       css : out STD_LOGIC; " 
  777                                         "architecture sub_sub_arch of sub_sub_mod is " 
  789                                         "       as, bs : in STD_LOGIC; " 
  790                                         "       cs : out STD_LOGIC; " 
  794                                         "architecture sub_arch of sub_mod is " 
  796                                         "   mid : sub_sub_mod " 
  806                                         "       a, b : in STD_LOGIC; " 
  807                                         "       c : out STD_LOGIC; " 
  811                                         "architecture top_arch of top is " 
  834                 auto vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  837                 ASSERT_TRUE(nl_res.is_ok());
 
  838                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  839                 ASSERT_NE(nl, 
nullptr);
 
  841                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_0")).size(), 1);
 
  842                 Module* inst_0 = nl->get_modules(test_utils::module_name_filter(
"inst_0")).front();
 
  843                 const auto pins_0 = inst_0->
get_pins();
 
  844                 EXPECT_EQ(pins_0.size(), 3);
 
  845                 EXPECT_EQ(pins_0.at(0)->get_name(), 
"as");
 
  846                 EXPECT_EQ(pins_0.at(0)->get_net()->get_name(), 
"a");
 
  847                 EXPECT_EQ(pins_0.at(1)->get_name(), 
"bs");
 
  848                 EXPECT_EQ(pins_0.at(1)->get_net()->get_name(), 
"b");
 
  849                 EXPECT_EQ(pins_0.at(2)->get_name(), 
"cs");
 
  850                 EXPECT_EQ(pins_0.at(2)->get_net()->get_name(), 
"c");
 
  852                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_1")).size(), 1);
 
  853                 Module* inst_1 = nl->get_modules(test_utils::module_name_filter(
"inst_1")).front();
 
  854                 const auto pins_1 = inst_1->
get_pins();
 
  855                 EXPECT_EQ(pins_1.size(), 2);
 
  856                 EXPECT_EQ(pins_1.at(0)->get_name(), 
"bs");
 
  857                 EXPECT_EQ(pins_1.at(0)->get_net()->get_name(), 
"b");
 
  858                 EXPECT_EQ(pins_1.at(1)->get_name(), 
"cs");
 
  859                 EXPECT_EQ(pins_1.at(1)->get_net()->get_name(), 
"c");
 
  861                 ASSERT_EQ(nl->get_modules(test_utils::module_name_filter(
"inst_2")).size(), 1);
 
  862                 Module* inst_2 = nl->get_modules(test_utils::module_name_filter(
"inst_2")).front();
 
  863                 const auto pins_2 = inst_2->
get_pins();
 
  864                 EXPECT_EQ(pins_2.size(), 1);
 
  865                 EXPECT_EQ(pins_2.at(0)->get_name(), 
"cs");
 
  866                 EXPECT_EQ(pins_2.at(0)->get_net()->get_name(), 
"c");
 
  881                 std::string netlist_input(
"-- Device\t: device_name\n" 
  882                                         "entity TEST_Comp is " 
  884                                         "    net_global_input : in STD_LOGIC := 'X'; " 
  887                                         "architecture STRUCTURE of TEST_Comp is " 
  891                                         "      key_integer => 1234," 
  892                                         "      key_floating_point => 1.234," 
  893                                         "      key_string => \"test_string\"," 
  894                                         "      key_bit_vector_hex => X\"abc\","     
  895                                         "      key_bit_vector_dec => D\"2748\"," 
  896                                         "      key_bit_vector_oct => O\"5274\"," 
  897                                         "      key_bit_vector_bin => B\"1010_1011_1100\"," 
  899                                         "      key_negative_comma_string => \"test,1,2,3\"," 
  900                                         "      key_negative_float_string => \"1.234\"," 
  902                                         "      key_boolean => true," 
  903                                         "      key_time => 1.234sec," 
  904                                         "      key_bit_value => '1'" 
  908                                         "      I => net_global_input " 
  912                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
  915                 ASSERT_TRUE(nl_res.is_ok());
 
  916                 std::unique_ptr<Netlist> nl = nl_res.get();
 
  917                 ASSERT_NE(nl, 
nullptr);
 
  919                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).size(), 1);
 
  920                 Gate* gate_0 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).begin();
 
  923                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_integer"), std::make_tuple(
"integer", 
"1234"));
 
  924                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_floating_point"),
 
  925                           std::make_tuple(
"floating_point", 
"1.234"));
 
  926                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_string"), std::make_tuple(
"string", 
"test_string"));
 
  927                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_bit_vector_hex"),
 
  928                           std::make_tuple(
"bit_vector", 
"ABC"));
 
  929                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_bit_vector_dec"),
 
  930                           std::make_tuple(
"bit_vector", 
"ABC"));
 
  931                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_bit_vector_oct"),
 
  932                           std::make_tuple(
"bit_vector", 
"ABC"));
 
  933                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_bit_vector_bin"),
 
  934                           std::make_tuple(
"bit_vector", 
"ABC"));
 
  936                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_negative_comma_string"),
 
  937                           std::make_tuple(
"string", 
"test,1,2,3"));
 
  938                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_negative_float_string"),
 
  939                           std::make_tuple(
"string", 
"1.234"));
 
  941                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_boolean"), std::make_tuple(
"boolean", 
"true"));
 
  942                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_time"), std::make_tuple(
"time", 
"1.234sec"));
 
  943                 EXPECT_EQ(gate_0->
get_data(
"generic", 
"key_bit_value"), std::make_tuple(
"bit_value", 
"1"));
 
  965                 std::string netlist_input(
"-- Device\t: device_name \n" 
  966                                         "entity TEST_Comp is " 
  968                                         "    net_global_in : in STD_LOGIC := 'X'; " 
  969                                         "    net_global_out : out STD_LOGIC := 'X'; " 
  972                                         "architecture STRUCTURE of TEST_Comp is " 
  973                                         "  signal n_vec_1 : STD_LOGIC_VECTOR ( 3 downto 0 ); " 
  974                                         "  signal n_vec_2 : STD_LOGIC_VECTOR ( 0 to 3 ); " 
  978                                         "      I => net_global_in, " 
  979                                         "      O0 => n_vec_1(0), " 
  980                                         "      O1 => n_vec_1(1), " 
  981                                         "      O2 => n_vec_1(2), " 
  986                                         "      I0 => n_vec_1(0), " 
  987                                         "      I1 => n_vec_1(1), " 
  988                                         "      I2 => n_vec_1(2), " 
  989                                         "      I3 => n_vec_1(3), " 
  990                                         "      O0 => n_vec_2(0), " 
  991                                         "      O1 => n_vec_2(1), " 
  992                                         "      O2 => n_vec_2(2), " 
  997                                         "      I0 => n_vec_2(0), " 
  998                                         "      I1 => n_vec_2(1), " 
  999                                         "      I2 => n_vec_2(2), " 
 1000                                         "      I3 => n_vec_2(3), " 
 1001                                         "      O => net_global_out " 
 1005                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1008                 ASSERT_TRUE(nl_res.is_ok());
 
 1009                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1010                 ASSERT_NE(nl, 
nullptr);
 
 1013                 EXPECT_EQ(nl->get_nets().size(),
 
 1015                 for (
auto net_name : std::set<std::string>({
"n_vec_1(0)", 
"n_vec_1(1)", 
"n_vec_1(2)", 
"n_vec_1(3)",
 
 1016                                                             "n_vec_2(0)", 
"n_vec_2(1)", 
"n_vec_2(2)", 
"n_vec_2(3)"})) {
 
 1017                     ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(net_name)).size(), 1);
 
 1019                 for (
unsigned i = 0; i < 4; i++) {
 
 1020                     std::string i_str = std::to_string(i);
 
 1022                         n_vec_1_i = *nl->get_nets(test_utils::net_name_filter(
"n_vec_1(" + i_str + 
")")).begin();
 
 1024                         n_vec_2_i = *nl->get_nets(test_utils::net_name_filter(
"n_vec_2(" + i_str + 
")")).begin();
 
 1026                     EXPECT_EQ(n_vec_1_i->
get_sources()[0]->get_pin()->get_name(), 
"O" + i_str);
 
 1027                     EXPECT_EQ((*n_vec_1_i->
get_destinations().begin())->get_pin()->get_name(), 
"I" + i_str);
 
 1029                     EXPECT_EQ(n_vec_2_i->
get_sources()[0]->get_pin()->get_name(), 
"O" + i_str);
 
 1030                     EXPECT_EQ((*n_vec_2_i->
get_destinations().begin())->get_pin()->get_name(), 
"I" + i_str);
 
 1035                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1036                                         "entity TEST_Comp is " 
 1038                                         "    net_global_in : in STD_LOGIC := 'X'; " 
 1039                                         "    net_global_out : out STD_LOGIC := 'X'; " 
 1042                                         "architecture STRUCTURE of TEST_Comp is " 
 1043                                         "  signal n_vec : STD_LOGIC_VECTOR2 ( 0 to 1, 2 to 3 ); " 
 1047                                         "      I => net_global_in, " 
 1048                                         "      O0 => n_vec(0,2), " 
 1049                                         "      O1 => n_vec(0,3), " 
 1050                                         "      O2 => n_vec(1, 2), " 
 1051                                         "      O3 => n_vec(1, 3) " 
 1055                                         "      I0 => n_vec(0, 2), " 
 1056                                         "      I1 => n_vec(0, 3), " 
 1057                                         "      I2 => n_vec(1, 2), " 
 1058                                         "      I3 => n_vec(1, 3), " 
 1059                                         "      O => net_global_out " 
 1063                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1066                 ASSERT_TRUE(nl_res.is_ok());
 
 1067                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1068                 ASSERT_NE(nl, 
nullptr);
 
 1071                 EXPECT_EQ(nl->get_nets().size(), 6);    
 
 1073                 for (
auto n : std::vector<std::string>({
"n_vec(0)(2)", 
"n_vec(0)(3)", 
"n_vec(1)(2)", 
"n_vec(1)(3)"})) {
 
 1074                     ASSERT_FALSE(nl->get_nets(test_utils::net_name_filter(
n)).empty());
 
 1075                     Net* n_vec_i_j = *nl->get_nets(test_utils::net_name_filter(
n)).begin();
 
 1077                     EXPECT_EQ(n_vec_i_j->
get_sources()[0]->get_pin()->get_name(), 
"O" + std::to_string(pin));
 
 1078                     EXPECT_EQ((*n_vec_i_j->
get_destinations().begin())->get_pin()->get_name(), 
"I" + std::to_string(pin));
 
 1084                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1085                                         "entity TEST_Comp is " 
 1087                                         "    net_global_in : in STD_LOGIC := 'X'; " 
 1088                                         "    net_global_out : out STD_LOGIC := 'X'; " 
 1091                                         "architecture STRUCTURE of TEST_Comp is " 
 1092                                         "  signal n_vec : STD_LOGIC_VECTOR3 ( 0 to 1, 1 downto 0, 0 to 1 ); " 
 1096                                         "      I => net_global_in, " 
 1097                                         "      O0 => n_vec(0, 0, 0), " 
 1098                                         "      O1 => n_vec(0, 0, 1), " 
 1099                                         "      O2 => n_vec(0, 1, 0), " 
 1100                                         "      O3 => n_vec(0, 1, 1), " 
 1101                                         "      O4 => n_vec(1, 0, 0), " 
 1102                                         "      O5 => n_vec(1, 0, 1), " 
 1103                                         "      O6 => n_vec(1, 1, 0), " 
 1104                                         "      O7 => n_vec(1, 1, 1) " 
 1108                                         "      I0 => n_vec(0, 0, 0), " 
 1109                                         "      I1 => n_vec(0, 0, 1), " 
 1110                                         "      I2 => n_vec(0, 1, 0), " 
 1111                                         "      I3 => n_vec(0, 1, 1), " 
 1112                                         "      I4 => n_vec(1, 0, 0), " 
 1113                                         "      I5 => n_vec(1, 0, 1), " 
 1114                                         "      I6 => n_vec(1, 1, 0), " 
 1115                                         "      I7 => n_vec(1, 1, 1), " 
 1116                                         "      O => net_global_out " 
 1120                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1123                 ASSERT_TRUE(nl_res.is_ok());
 
 1124                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1125                 ASSERT_NE(nl, 
nullptr);
 
 1128                 EXPECT_EQ(nl->get_nets().size(), 10);    
 
 1129                 std::vector<std::string> net_idx
 
 1130                     ({
"(0)(0)(0)", 
"(0)(0)(1)", 
"(0)(1)(0)", 
"(0)(1)(1)", 
"(1)(0)(0)", 
"(1)(0)(1)", 
"(1)(1)(0)",
 
 1132                 for (
size_t idx = 0; idx < 8; idx++) {
 
 1133                     ASSERT_FALSE(nl->get_nets(test_utils::net_name_filter(
"n_vec" + net_idx[idx])).empty());
 
 1135                         n_vec_i_j = *nl->get_nets(test_utils::net_name_filter(
"n_vec" + net_idx[idx])).begin();
 
 1137                     EXPECT_EQ(n_vec_i_j->
get_sources()[0]->get_pin()->get_name(), 
"O" + std::to_string(idx));
 
 1138                     EXPECT_EQ((*n_vec_i_j->
get_destinations().begin())->get_pin()->get_name(), 
"I" + std::to_string(idx));
 
 1153                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1154                                         "entity TEST_Comp is " 
 1156                                         "    net_global_out_0 : out STD_LOGIC; " 
 1157                                         "    net_global_out_1 : out STD_LOGIC; " 
 1158                                         "    net_global_out_2 : out STD_LOGIC; " 
 1159                                         "    net_global_out_3 : out STD_LOGIC " 
 1162                                         "architecture STRUCTURE of TEST_Comp is " 
 1167                                         "      O => net_global_out_0 " 
 1172                                         "      O => net_global_out_1 " 
 1177                                         "      O => net_global_out_2 " 
 1182                                         "      O => net_global_out_3 " 
 1186                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1189                 ASSERT_TRUE(nl_res.is_ok());
 
 1190                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1191                 ASSERT_NE(nl, 
nullptr);
 
 1193                 Gate* gate_0 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).begin();
 
 1194                 ASSERT_NE(gate_0, 
nullptr);
 
 1195                 Gate* gate_1 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_1")).begin();
 
 1196                 ASSERT_NE(gate_1, 
nullptr);
 
 1197                 Gate* gate_2 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_2")).begin();
 
 1198                 ASSERT_NE(gate_2, 
nullptr);
 
 1199                 Gate* gate_3 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_3")).begin();
 
 1200                 ASSERT_NE(gate_3, 
nullptr);
 
 1204                 ASSERT_NE(net_gnd, 
nullptr);
 
 1205                 EXPECT_EQ(net_gnd->
get_name(), 
"'0'");
 
 1207                 ASSERT_NE(net_gnd->
get_sources()[0]->get_gate(), 
nullptr);
 
 1208                 EXPECT_TRUE(net_gnd->
get_sources()[0]->get_gate()->is_gnd_gate());
 
 1212                 ASSERT_NE(net_vcc, 
nullptr);
 
 1213                 EXPECT_EQ(net_vcc->
get_name(), 
"'1'");
 
 1215                 ASSERT_NE(net_vcc->
get_sources()[0]->get_gate(), 
nullptr);
 
 1216                 EXPECT_TRUE(net_vcc->
get_sources()[0]->get_gate()->is_vcc_gate());
 
 1248                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1249                                         "entity MODULE_CHILD is " 
 1250                                         "  attribute child_attribute : string; " 
 1251                                         "  attribute child_attribute of MODULE_CHILD : entity is \"child_attribute_value\"; " 
 1253                                         "    child_in : in STD_LOGIC; " 
 1254                                         "    child_out : out STD_LOGIC " 
 1256                                         "end MODULE_CHILD; " 
 1257                                         "architecture STRUCTURE_CHILD of MODULE_CHILD is " 
 1258                                         "  signal net_0_child : STD_LOGIC; " 
 1259                                         "  attribute child_net_attribute : string; " 
 1260                                         "  attribute child_net_attribute of child_in : signal is \"child_net_attribute_value\"; " 
 1262                                         "  gate_0_child : BUF " 
 1265                                         "      O => net_0_child " 
 1267                                         "  gate_1_child : BUF " 
 1269                                         "      I => net_0_child, " 
 1272                                         "end STRUCTURE_CHILD; " 
 1274                                         "entity MODULE_TOP is " 
 1276                                         "    net_global_in : in STD_LOGIC; " 
 1277                                         "    net_global_out : out STD_LOGIC " 
 1280                                         "architecture STRUCTURE of MODULE_TOP is " 
 1281                                         "  signal net_0 : STD_LOGIC; " 
 1282                                         "  signal net_1 : STD_LOGIC; " 
 1287                                         "      I => net_global_in, " 
 1290                                         "  child_mod : MODULE_CHILD " 
 1292                                         "      child_in => net_0, " 
 1293                                         "      child_out => net_1 " 
 1298                                         "      O => net_global_out " 
 1302                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1305                 ASSERT_TRUE(nl_res.is_ok());
 
 1306                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1307                 ASSERT_NE(nl, 
nullptr);
 
 1310                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).size(), 1);
 
 1311                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_1")).size(), 1);
 
 1312                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0_child")).size(), 1);
 
 1313                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_1_child")).size(), 1);
 
 1314                 Gate* gate_0 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).begin();
 
 1315                 Gate* gate_1 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_1")).begin();
 
 1316                 Gate* gate_0_child = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0_child")).begin();
 
 1317                 Gate* gate_1_child = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_1_child")).begin();
 
 1320                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_0")).size(), 1);
 
 1321                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_1")).size(), 1);
 
 1322                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_global_in")).size(), 1);
 
 1323                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_global_out")).size(), 1);
 
 1324                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_0_child")).size(), 1);
 
 1325                 Net* net_0 = *nl->get_nets(test_utils::net_name_filter(
"net_0")).begin();
 
 1326                 Net* net_1 = *nl->get_nets(test_utils::net_name_filter(
"net_1")).begin();
 
 1327                 Net* net_global_in = *nl->get_nets(test_utils::net_name_filter(
"net_global_in")).begin();
 
 1328                 Net* net_global_out = *nl->get_nets(test_utils::net_name_filter(
"net_global_out")).begin();
 
 1329                 Net* net_0_child = *nl->get_nets(test_utils::net_name_filter(
"net_0_child")).begin();
 
 1342                 Module* top_mod = nl->get_top_module();
 
 1343                 ASSERT_NE(top_mod, 
nullptr);
 
 1345                 EXPECT_EQ(top_mod->
get_name(), 
"top_module");
 
 1346                 EXPECT_EQ(top_mod->
get_type(), 
"MODULE_TOP");
 
 1349                 ASSERT_NE(child_mod, 
nullptr);
 
 1350                 EXPECT_EQ(child_mod->
get_name(), 
"child_mod");
 
 1351                 EXPECT_EQ(child_mod->
get_type(), 
"MODULE_CHILD");
 
 1352                 EXPECT_EQ(top_mod->
get_gates(), std::vector<Gate*>({gate_0, gate_1}));
 
 1353                 EXPECT_EQ(child_mod->
get_gates(), std::vector<Gate*>({gate_0_child, gate_1_child}));
 
 1356                 EXPECT_EQ(net_0->
get_data(
"attribute", 
"child_net_attribute"), std::make_tuple(
"string", 
"child_net_attribute_value"));
 
 1357                 EXPECT_EQ(child_mod->
get_data(
"attribute", 
"child_attribute"), std::make_tuple(
"string", 
"child_attribute_value"));
 
 1378                 std::string netlist_input(
"-- Device\t: device_name \n" 
 1379                                         "entity ENT_CHILD_TWO is " 
 1381                                         "    I_c2 : in STD_LOGIC; " 
 1382                                         "    O_c2 : out STD_LOGIC " 
 1384                                         "end ENT_CHILD_TWO; " 
 1385                                         "architecture STRUCTURE_CHILD_TWO of ENT_CHILD_TWO is " 
 1387                                         "  gate_child_two : BUF " 
 1392                                         "end STRUCTURE_CHILD_TWO; " 
 1394                                         "entity ENT_CHILD_ONE is " 
 1396                                         "    I_c1 : in STD_LOGIC; " 
 1397                                         "    O_c1 : out STD_LOGIC" 
 1399                                         "end ENT_CHILD_ONE; " 
 1400                                         "architecture STRUCTURE_CHILD_ONE of ENT_CHILD_ONE is " 
 1401                                         "  signal net_child_0 : STD_LOGIC; " 
 1402                                         "  signal net_child_1 : STD_LOGIC; " 
 1404                                         "  gate_0_ent_two : ENT_CHILD_TWO " 
 1407                                         "      O_c2 => net_child_0 " 
 1409                                         "  gate_1_ent_two : ENT_CHILD_TWO " 
 1411                                         "      I_c2 => net_child_0, " 
 1412                                         "      O_c2 => net_child_1 " 
 1414                                         "  gate_child_one : BUF " 
 1416                                         "      I => net_child_1, " 
 1419                                         "end STRUCTURE_CHILD_ONE; " 
 1421                                         "entity ENT_TOP is " 
 1423                                         "    net_global_in : in STD_LOGIC; " 
 1424                                         "    net_global_out : out STD_LOGIC " 
 1427                                         "architecture STRUCTURE of ENT_TOP is " 
 1428                                         "  signal net_0 : STD_LOGIC; " 
 1429                                         "  signal net_1 : STD_LOGIC; " 
 1431                                         "  child_one_mod : ENT_CHILD_ONE " 
 1433                                         "      I_c1 => net_global_in, " 
 1436                                         "  child_two_mod : ENT_CHILD_TWO " 
 1444                                         "      O => net_global_out " 
 1448                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1451                 ASSERT_TRUE(nl_res.is_ok());
 
 1452                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1455                 ASSERT_NE(nl, 
nullptr);
 
 1456                 EXPECT_EQ(nl->get_gates().size(), 5);      
 
 1457                 EXPECT_EQ(nl->get_modules().size(), 5);    
 
 1458                 Module* top_module = nl->get_top_module();
 
 1464                     std::swap(top_child_one, top_child_two);
 
 1472                 std::string module_suffix = 
"";
 
 1474                 EXPECT_EQ(top_child_one->
get_name(), 
"child_one_mod");
 
 1480                 EXPECT_EQ(std::set<std::string>({top_child_two->
get_name(), one_child_0->
get_name(),
 
 1481                                                  one_child_1->
get_name()}).size(), 3);
 
 1484                 std::string gate_suffix = 
"";
 
 1486                 ASSERT_EQ(top_module->
get_gates().size(), 1);
 
 1487                 EXPECT_EQ((*top_module->
get_gates().begin())->get_name(), 
"gate_top");
 
 1489                 ASSERT_EQ(top_child_one->
get_gates().size(), 1);
 
 1490                 EXPECT_EQ((*top_child_one->
get_gates().begin())->get_name(), 
"gate_child_one");
 
 1492                 ASSERT_EQ(top_child_two->
get_gates().size(), 1);
 
 1493                 ASSERT_EQ(one_child_0->
get_gates().size(), 1);
 
 1494                 ASSERT_EQ(one_child_1->
get_gates().size(), 1);
 
 1495                 Gate* gate_child_two_0 = *top_child_two->
get_gates().begin();
 
 1503                 EXPECT_EQ(std::set<std::string>({gate_child_two_0->
get_name(), gate_child_two_1->
get_name(),
 
 1504                                                  gate_child_two_2->
get_name()}).size(), 3);
 
 1518                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1519                                         "entity ENT_MODULE is " 
 1521                                         "    mod_in : in STD_LOGIC := 'X'; " 
 1522                                         "    mod_out : out STD_LOGIC := 'X'; " 
 1525                                         "architecture STRUCTURE_MODULE of ENT_MODULE is " 
 1526                                         "  signal mod_inner : STD_LOGIC; " 
 1528                                         "  mod_inner <= mod_out; " 
 1538                                         "end STRUCTURE_MODULE;\n" 
 1539                                         "---------------------------------------\n" 
 1540                                         "entity ENT_TOP is " 
 1542                                         "    net_global_in : in STD_LOGIC := 'X'; " 
 1543                                         "    net_global_out : out STD_LOGIC := 'X'; " 
 1546                                         "architecture STRUCTURE_TOP of ENT_TOP is " 
 1547                                         "  signal net_0 : STD_LOGIC; " 
 1549                                         "  mod : ENT_MODULE " 
 1551                                         "      mod_in => net_global_in, " 
 1552                                         "      mod_out => net_0 " 
 1557                                         "      O => net_global_out " 
 1559                                         "end STRUCTURE_TOP;");
 
 1561                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1564                 ASSERT_TRUE(nl_res.is_ok());
 
 1565                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1568                 ASSERT_NE(nl, 
nullptr);
 
 1569                 EXPECT_EQ(nl->get_gates().size(), 3);      
 
 1570                 EXPECT_EQ(nl->get_modules().size(), 2);    
 
 1571                 Module* top_module = nl->get_top_module();
 
 1576                 ASSERT_EQ(mod->
get_gates(test_utils::gate_name_filter(
"gate_a")).size(), 1);
 
 1577                 ASSERT_EQ(mod->
get_gates(test_utils::gate_name_filter(
"gate_b")).size(), 1);
 
 1578                 ASSERT_EQ(nl->get_gates(test_utils::gate_name_filter(
"gate_top")).size(), 1);
 
 1579                 Gate* gate_a = *mod->
get_gates(test_utils::gate_name_filter(
"gate_a")).begin();
 
 1580                 Gate* gate_b = *mod->
get_gates(test_utils::gate_name_filter(
"gate_b")).begin();
 
 1581                 Gate* gate_top = *nl->get_gates(test_utils::gate_name_filter(
"gate_top")).begin();
 
 1584                 ASSERT_NE(mod_out, 
nullptr);
 
 1589                                                                   std::vector<Endpoint*>({test_utils::get_endpoint(gate_b,
 
 1591                                                                                           test_utils::get_endpoint(
 
 1621                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1622                                         "entity MODULE_A is\n" 
 1624                                         "    I_A : in STD_LOGIC := 'X';\n" 
 1625                                         "    O_A : out STD_LOGIC := 'X';\n" 
 1628                                         "architecture STRUCT_MODULE_A of MODULE_A is\n" 
 1629                                         "  signal shared_net_name : STD_LOGIC;\n" 
 1630                                         "  signal net_a : STD_LOGIC;\n" 
 1632                                         "  shared_gate_name : COMB12\n" 
 1635                                         "      O0 => shared_net_name,\n" 
 1638                                         "  gate_a : COMB21\n" 
 1640                                         "      I0 => shared_net_name,\n" 
 1644                                         "end STRUCT_MODULE_A;\n" 
 1646                                         "entity MODULE_B is\n" 
 1648                                         "    I_B : in STD_LOGIC := 'X';\n" 
 1649                                         "    O_B : out STD_LOGIC := 'X';\n" 
 1652                                         "architecture STRUCT_MODULE_B of MODULE_B is\n" 
 1653                                         "  signal shared_net_name : STD_LOGIC;\n" 
 1654                                         "  signal net_b : STD_LOGIC;\n" 
 1656                                         "  shared_gate_name : COMB12\n" 
 1659                                         "      O0 => shared_net_name,\n" 
 1662                                         "  gate_b : COMB21\n" 
 1664                                         "      I0 => shared_net_name,\n" 
 1668                                         "end STRUCT_MODULE_B;\n" 
 1670                                         "entity ENT_TOP is\n" 
 1672                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 1673                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 1676                                         "architecture STRUCTURE_TOP of ENT_TOP is\n" 
 1677                                         "  signal net_0 : STD_LOGIC;\n" 
 1678                                         "  signal net_1 : STD_LOGIC;\n" 
 1679                                         "  signal net_2 : STD_LOGIC;\n" 
 1681                                         "  mod_b_0 : MODULE_B\n" 
 1683                                         "      I_B => net_global_in,\n" 
 1686                                         "  mod_a_0 : MODULE_A\n" 
 1691                                         "  mod_b_1 : MODULE_B\n" 
 1699                                         "      O => net_global_out\n" 
 1701                                         "end STRUCTURE_TOP;");
 
 1703                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1706                 ASSERT_TRUE(nl_res.is_ok());
 
 1707                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1710                 ASSERT_NE(nl, 
nullptr);
 
 1715                 Net* glob_in = *nl->get_global_input_nets().begin();
 
 1716                 ASSERT_NE(glob_in, 
nullptr);
 
 1720                 ASSERT_NE(shared_gate_0, 
nullptr);
 
 1723                 std::vector<Gate*> nl_gates = {shared_gate_0};
 
 1724                 std::vector<std::string> suc_pin = {
"O0",
"O",
"O0",
"O",
"O0",
"O"};
 
 1725                 for(
size_t idx = 0; idx < suc_pin.size(); idx++){
 
 1726                     ASSERT_NE(nl_gates[idx]->get_successor(suc_pin[idx]), 
nullptr);
 
 1728                     ASSERT_NE(next_gate, 
nullptr);
 
 1729                     nl_gates.push_back(next_gate);
 
 1733                 std::vector<Net*> nl_nets = {glob_in};
 
 1734                 std::vector<std::pair<Gate*, std::string>> net_out_gate_and_pin = {{nl_gates[0], 
"O0"}, {nl_gates[0], 
"O1"}, {nl_gates[1], 
"O"}, {nl_gates[2], 
"O0"},
 
 1735                                                                                    {nl_gates[2], 
"O1"}, {nl_gates[3], 
"O"}, {nl_gates[4], 
"O0"}, {nl_gates[4], 
"O1"}, {nl_gates[5], 
"O"}, {nl_gates[6], 
"O"}};
 
 1736                 for(
size_t idx = 0; idx < net_out_gate_and_pin.size(); idx++){
 
 1737                     Net* next_net = (net_out_gate_and_pin[idx].first)->get_fan_out_net(net_out_gate_and_pin[idx].second);
 
 1738                     ASSERT_NE(next_net, 
nullptr);
 
 1739                     nl_nets.push_back(next_net);
 
 1743                 std::vector<std::string> nl_gate_names;
 
 1744                 for(
Gate* 
g : nl_gates) nl_gate_names.push_back(
g->get_name());
 
 1745                 std::vector<std::string> expected_gate_names = {
"mod_b_0/shared_gate_name", 
"mod_b_0/gate_b", 
"mod_a_0/shared_gate_name", 
"gate_a", 
"mod_b_1/shared_gate_name", 
"mod_b_1/gate_b", 
"gate_top"};
 
 1746                 EXPECT_EQ(nl_gate_names, expected_gate_names);
 
 1749                 std::vector<std::string> nl_net_names;
 
 1750                 for(
Net* 
n : nl_nets) nl_net_names.push_back(
n->get_name());
 
 1751                 std::vector<std::string> expected_net_names = {
"net_global_in", 
"mod_b_0/shared_net_name", 
"mod_b_0/net_b", 
"net_0", 
"mod_a_0/shared_net_name", 
"net_a", 
"net_1", 
"mod_b_1/shared_net_name", 
"mod_b_1/net_b", 
"net_2", 
"net_global_out"};
 
 1752                 EXPECT_EQ(nl_net_names, expected_net_names);
 
 1779                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1780                                         "entity TEST_Comp is " 
 1782                                         "    net_global_in : in STD_LOGIC := 'X'; " 
 1783                                         "    net_global_out : out STD_LOGIC := 'X'; " 
 1784                                         "    net_master: in STD_LOGIC := 'X'; " 
 1787                                         "architecture STRUCTURE of TEST_Comp is " 
 1788                                         "  signal net_slave_0 : STD_LOGIC; " 
 1789                                         "  signal net_slave_2 : STD_LOGIC; " 
 1790                                         "  signal net_slave_1 : STD_LOGIC; " 
 1791                                         "  attribute slave_0_attr : string; "     
 1792                                         "  attribute slave_0_attr of net_slave_0 : signal is \"slave_0_attr\"; " 
 1793                                         "  attribute slave_1_attr : string; " 
 1794                                         "  attribute slave_1_attr of net_slave_1 : signal is \"slave_1_attr\"; " 
 1795                                         "  attribute slave_2_attr : string; " 
 1796                                         "  attribute slave_2_attr of net_slave_2 : signal is \"slave_2_attr\"; " 
 1797                                         "  attribute master_attr : string; " 
 1798                                         "  attribute master_attr of net_master : signal is \"master_attr\"; " 
 1800                                         "  net_slave_1 <= net_slave_0;  " 
 1801                                         "  net_slave_2 <= net_slave_0; " 
 1802                                         "  net_master <= net_slave_0; " 
 1805                                         "      I => net_global_in, " 
 1806                                         "      O => net_slave_0 " 
 1810                                         "      I0 => net_master, " 
 1811                                         "      I1 => net_slave_1, " 
 1812                                         "      I2 => net_slave_2, " 
 1813                                         "      O => net_global_out " 
 1817                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1820                 ASSERT_TRUE(nl_res.is_ok());
 
 1821                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1823                 ASSERT_NE(nl, 
nullptr);
 
 1824                 EXPECT_EQ(nl->get_nets().size(), 3);    
 
 1825                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_master")).size(), 1);
 
 1826                 Net* net_master = *nl->get_nets(test_utils::net_name_filter(
"net_master")).begin();
 
 1828                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).size(), 1);
 
 1829                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"AND3", 
"gate_1")).size(), 1);
 
 1831                 Gate* g_0 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).begin();
 
 1832                 Gate* g_1 = *nl->get_gates(test_utils::gate_filter(
"AND3", 
"gate_1")).begin();
 
 1844                 EXPECT_EQ(net_master->
get_data(
"attribute", 
"master_attr"),
 
 1845                           std::make_tuple(
"string", 
"master_attr"));
 
 1846                 EXPECT_EQ(net_master->
get_data(
"attribute", 
"slave_0_attr"),
 
 1847                           std::make_tuple(
"string", 
"slave_0_attr"));
 
 1848                 EXPECT_EQ(net_master->
get_data(
"attribute", 
"slave_1_attr"),
 
 1849                           std::make_tuple(
"string", 
"slave_1_attr"));
 
 1850                 EXPECT_EQ(net_master->
get_data(
"attribute", 
"slave_2_attr"),
 
 1851                           std::make_tuple(
"string", 
"slave_2_attr"));
 
 1856                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1857                                         "entity TEST_Comp is " 
 1859                                         "    net_global_in : in STD_LOGIC := 'X'; " 
 1860                                         "    net_global_out : out STD_LOGIC := 'X'; " 
 1863                                         "architecture STRUCTURE of TEST_Comp is " 
 1864                                         "  signal net_0 : STD_LOGIC; " 
 1865                                         "  signal net_1 : STD_LOGIC; " 
 1871                                         "      I => net_global_in, " 
 1877                                         "      O => net_global_out " 
 1881                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1884                 ASSERT_TRUE(nl_res.is_ok());
 
 1885                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1887                 ASSERT_NE(nl, 
nullptr);
 
 1888                 EXPECT_EQ(nl->get_nets().size(), 3);    
 
 1889                 EXPECT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_0")).size(), 1);
 
 1893                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1894                                         "entity TEST_Comp is " 
 1896                                         "    net_global_in : in STD_LOGIC := 'X'; " 
 1897                                         "    net_global_out : out STD_LOGIC := 'X'; " 
 1900                                         "architecture STRUCTURE of TEST_Comp is " 
 1901                                         "  signal net_slave : STD_LOGIC_VECTOR ( 0 to 3 ); " 
 1902                                         "  signal net_master : STD_LOGIC_VECTOR ( 0 to 3 ); " 
 1904                                         "  net_master <= net_slave; " 
 1907                                         "      I => net_global_in, " 
 1908                                         "      O => net_slave(0) " 
 1912                                         "      I0 => net_master(0), " 
 1913                                         "      I1 => net_slave(1), " 
 1914                                         "      I2 => net_slave(2), " 
 1915                                         "      O => net_global_out " 
 1919                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1922                 ASSERT_TRUE(nl_res.is_ok());
 
 1923                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1925                 ASSERT_NE(nl, 
nullptr);
 
 1927                 ASSERT_EQ(nl->get_gates(test_utils::gate_name_filter(
"gate_0")).size(), 1);
 
 1928                 ASSERT_EQ(nl->get_gates(test_utils::gate_name_filter(
"gate_1")).size(), 1);
 
 1929                 Gate* gate_0 = *nl->get_gates(test_utils::gate_name_filter(
"gate_0")).begin();
 
 1930                 Gate* gate_1 = *nl->get_gates(test_utils::gate_name_filter(
"gate_1")).begin();
 
 1956                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1957                                         "entity TEST_Comp is\n" 
 1961                                         "architecture STRUCTURE of TEST_Comp is\n" 
 1965                                         "      ADDR => B\"0101\"\n" 
 1969                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 1972                 ASSERT_TRUE(nl_res.is_ok());
 
 1973                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 1975                 ASSERT_NE(nl, 
nullptr);
 
 1976                 ASSERT_FALSE(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).empty());
 
 1977                 Gate* gate_0 = *(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).begin());
 
 1980                 ASSERT_NE(net_0, 
nullptr);
 
 1981                 EXPECT_EQ(net_0->
get_name(), 
"'1'");
 
 1984                 ASSERT_NE(net_1, 
nullptr);
 
 1985                 EXPECT_EQ(net_1->
get_name(), 
"'0'");
 
 1988                 ASSERT_NE(net_2, 
nullptr);
 
 1989                 EXPECT_EQ(net_2->
get_name(), 
"'1'");
 
 1992                 ASSERT_NE(net_3, 
nullptr);
 
 1993                 EXPECT_EQ(net_3->
get_name(), 
"'0'");
 
 1997                 std::string netlist_input(
"-- Device\t: device_name\n" 
 1998                                         "entity TEST_Comp is\n" 
 2002                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2003                                         "  signal l_vec : STD_LOGIC_VECTOR ( 3 downto 0 );\n" 
 2007                                         "      DATA_OUT => l_vec\n" 
 2011                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2014                 ASSERT_TRUE(nl_res.is_ok());
 
 2015                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2017                 ASSERT_NE(nl, 
nullptr);
 
 2018                 ASSERT_FALSE(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).empty());
 
 2019                 Gate* gate_0 = *(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).begin());
 
 2024                 ASSERT_NE(net_0, 
nullptr);
 
 2025                 EXPECT_EQ(net_0->
get_name(), 
"l_vec(0)");
 
 2028                 ASSERT_NE(net_1, 
nullptr);
 
 2029                 EXPECT_EQ(net_1->
get_name(), 
"l_vec(1)");
 
 2032                 ASSERT_NE(net_2, 
nullptr);
 
 2033                 EXPECT_EQ(net_2->
get_name(), 
"l_vec(2)");
 
 2036                 ASSERT_NE(net_3, 
nullptr);
 
 2037                 EXPECT_EQ(net_3->
get_name(), 
"l_vec(3)");
 
 2042                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2043                                         "entity TEST_Comp is\n" 
 2047                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2048                                         "  signal l_vec : STD_LOGIC_VECTOR ( 3 downto 0 );\n" 
 2052                                         "      DATA_OUT(3 downto 2) => l_vec(2 downto 1)\n" 
 2056                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2059                 ASSERT_TRUE(nl_res.is_ok());
 
 2060                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2062                 ASSERT_NE(nl, 
nullptr);
 
 2063                 ASSERT_FALSE(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).empty());
 
 2064                 Gate* gate_0 = *(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).begin());
 
 2069                 ASSERT_NE(net_1, 
nullptr);
 
 2070                 EXPECT_EQ(net_1->
get_name(), 
"l_vec(2)");
 
 2073                 ASSERT_NE(net_2, 
nullptr);
 
 2074                 EXPECT_EQ(net_2->
get_name(), 
"l_vec(1)");
 
 2078                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2079                                         "entity TEST_Comp is\n" 
 2083                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2084                                         "  signal l_vec : STD_LOGIC_VECTOR ( 3 downto 0 );\n" 
 2088                                         "      DATA_OUT(2 to 3) => l_vec(2 downto 1)\n" 
 2092                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2095                 ASSERT_TRUE(nl_res.is_ok());
 
 2096                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2098                 ASSERT_NE(nl, 
nullptr);
 
 2099                 ASSERT_FALSE(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).empty());
 
 2100                 Gate* gate_0 = *(nl->get_gates(test_utils::gate_filter(
"RAM", 
"gate_0")).begin());
 
 2105                 ASSERT_NE(net_1, 
nullptr);
 
 2106                 EXPECT_EQ(net_1->
get_name(), 
"l_vec(2)");
 
 2109                 ASSERT_NE(net_2, 
nullptr);
 
 2110                 EXPECT_EQ(net_2->
get_name(), 
"l_vec(1)");
 
 2129                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2130                                         "entity TEST_Comp is " 
 2132                                         "    net_global_input : in STD_LOGIC := 'X'; " 
 2135                                         "architecture STRUCTURE of TEST_Comp is " 
 2139                                         "      no_comment_0 => 123, -- comment_0 => 123, \t --comment_1 => 123\n" 
 2140                                         "      no_comment_1 => 123,\n" 
 2141                                         "      -- comment_2 => 123,\n" 
 2142                                         "      no_comment_2 => 123\n" 
 2145                                         "      I => net_global_input " 
 2149                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2152                 ASSERT_TRUE(nl_res.is_ok());
 
 2153                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2155                 ASSERT_NE(nl, 
nullptr);
 
 2156                 ASSERT_EQ(nl->get_gates(test_utils::gate_filter(
"BUF", 
"test_gate")).size(), 1);
 
 2157                 Gate* test_gate = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"test_gate")).begin();
 
 2160                 for (std::string key : std::set<std::string>({
"no_comment_0", 
"no_comment_1", 
"no_comment_2"})) {
 
 2161                     EXPECT_NE(test_gate->
get_data(
"generic", key), std::make_tuple(
"", 
""));
 
 2162                     if (test_gate->
get_data(
"generic", key) == std::make_tuple(
"", 
"")) {
 
 2163                         std::cout << 
"comment test failed for: " << key << std::endl;
 
 2168                 for (std::string key : std::set<std::string>({
"comment_0", 
"comment_1", 
"comment_2"})) {
 
 2169                     EXPECT_EQ(test_gate->
get_data(
"generic", key), std::make_tuple(
"", 
""));
 
 2170                     if (test_gate->
get_data(
"generic", key) != std::make_tuple(
"", 
"")) {
 
 2171                         std::cout << 
"comment failed for: " << key << std::endl;
 
 2188                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2189                                         "entity TEST_Comp is\n" 
 2191                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 2192                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 2195                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2196                                         "  attribute attri_name : attri_type;\n" 
 2197                                         "  attribute attri_name of gate_0 : label is attri_value;\n" 
 2201                                         "      I => net_global_in,\n" 
 2202                                         "      O => net_global_out\n" 
 2206                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2209                 ASSERT_TRUE(nl_res.is_ok());
 
 2210                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2212                 ASSERT_NE(nl, 
nullptr);
 
 2213                 ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"BUF")).size(), 1);
 
 2214                 Gate* attri_gate = *nl->get_gates(test_utils::gate_type_filter(
"BUF")).begin();
 
 2215                 EXPECT_EQ(attri_gate->
get_data(
"attribute", 
"attri_name"),
 
 2216                           std::make_tuple(
"attri_type", 
"attri_value"));
 
 2220                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2221                                         "entity TEST_Comp is\n" 
 2223                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 2224                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 2227                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2228                                         "  signal net_0 : STD_LOGIC;\n" 
 2229                                         "  attribute attri_name : attri_type;\n" 
 2230                                         "  attribute attri_name of net_0 : signal is \"attri_value\";\n" 
 2234                                         "      I => net_global_in,\n" 
 2240                                         "      O => net_global_out\n" 
 2244                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2247                 ASSERT_TRUE(nl_res.is_ok());
 
 2248                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2250                 ASSERT_NE(nl, 
nullptr);
 
 2251                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_0")).size(), 1);
 
 2252                 Net* attri_net = *nl->get_nets(test_utils::net_name_filter(
"net_0")).begin();
 
 2253                 EXPECT_NE(attri_net, 
nullptr);
 
 2254                 EXPECT_EQ(attri_net->
get_data(
"attribute", 
"attri_name"),
 
 2255                           std::make_tuple(
"attri_type", 
"attri_value"));
 
 2259                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2260                                         "entity TEST_Comp is\n" 
 2262                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 2263                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 2266                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2267                                         "  signal net_0 : STD_LOGIC;\n" 
 2268                                         "  attribute attri_comma_string : attri_type_0;\n" 
 2269                                         "  attribute attri_comma_string of net_0 : signal is \"test, 1, 2, 3\";\n" 
 2270                                         "  attribute attri_float_string : attri_type_1;\n" 
 2271                                         "  attribute attri_float_string of gate_0 : label is \"1.234\";\n" 
 2275                                         "      I => net_global_in,\n" 
 2281                                         "      O => net_global_out\n" 
 2285                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2288                 ASSERT_TRUE(nl_res.is_ok());
 
 2289                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2291                 ASSERT_NE(nl, 
nullptr);
 
 2292                 ASSERT_EQ(nl->get_nets(test_utils::net_name_filter(
"net_0")).size(), 1);
 
 2293                 Net* attri_net = *nl->get_nets(test_utils::net_name_filter(
"net_0")).begin();
 
 2294                 EXPECT_NE(attri_net, 
nullptr);
 
 2296                 ASSERT_EQ(nl->get_gates(test_utils::gate_name_filter(
"gate_0")).size(), 1);
 
 2297                 Gate* attri_gate = *nl->get_gates(test_utils::gate_name_filter(
"gate_0")).begin();
 
 2300                 EXPECT_EQ(attri_net->
get_data(
"attribute", 
"attri_comma_string"),
 
 2301                           std::make_tuple(
"attri_type_0", 
"test, 1, 2, 3"));
 
 2302                 EXPECT_EQ(attri_gate->
get_data(
"attribute", 
"attri_float_string"),
 
 2303                           std::make_tuple(
"attri_type_1", 
"1.234"));
 
 2316             std::string netlist_input(
"-- Device\t: device_name\n" 
 2317                                     "library SIMPRIM;\n" 
 2318                                     "use SIMPRIM.VCOMPONENTS.ALL;\n" 
 2319                                     "entity TEST_Comp is\n" 
 2321                                     "    net_global_input : in STD_LOGIC := 'X';\n" 
 2324                                     "architecture STRUCTURE of TEST_Comp is\n" 
 2326                                     "  gate_0 : SIMPRIM.VCOMPONENTS.BUF\n" 
 2328                                     "      I => net_global_input\n" 
 2332             std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2335             ASSERT_TRUE(nl_res.is_ok());
 
 2336             std::unique_ptr<Netlist> nl = nl_res.get();
 
 2338             ASSERT_NE(nl, 
nullptr);
 
 2340             EXPECT_EQ(nl->get_gates(test_utils::gate_type_filter(
"BUF")).size(), 1);
 
 2407                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2408                                         "entity TEST_Comp is\n" 
 2410                                         "    global_in: in STD_LOGIC := 'X';\n" 
 2413                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2417                                         "      NON_EXISTING_PIN => global_in\n" 
 2421                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2424                 EXPECT_TRUE(nl_res.is_error());
 
 2429                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2430                                         "entity TEST_Comp is\n" 
 2432                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 2433                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 2436                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2438                                         "  gate_0 : UNKNOWN_GATE_TYPE\n" 
 2440                                         "      I => net_global_in,\n" 
 2441                                         "      O => net_global_out\n" 
 2445                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2448                 EXPECT_TRUE(nl_res.is_error());
 
 2453                 std::string netlist_input(
"");
 
 2455                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2458                 EXPECT_TRUE(nl_res.is_error());
 
 2503             if(test_utils::known_issue_tests_active())
 
 2506                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2507                                         "entity TEST_Comp is\n" 
 2511                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2512                                         "  signal l_vec : STD_LOGIC_VECTOR ( 4 downto 0 );\n" 
 2516                                         "      O(p downto q) => l_vec(p downto q)\n"  
 2520                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2523                 EXPECT_TRUE(nl_res.is_error());
 
 2529                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2530                                         "entity TEST_Comp is\n" 
 2532                                         "    net_global_input : invalid_direction STD_LOGIC := 'X';\n"     
 2535                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2539                                         "      O => net_global_input\n" 
 2543                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2546                 EXPECT_TRUE(nl_res.is_error());
 
 2551                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2552                                         "entity TEST_Comp is\n" 
 2554                                         "    net_global_input : in STD_LOGIC := 'X';\n" 
 2557                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2558                                         "unknown_keyword some_signal : STD_LOGIC;"     
 2562                                         "      O => net_global_input\n" 
 2566                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2569                 EXPECT_TRUE(nl_res.is_error());
 
 2574                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2575                                         "entity TEST_Comp is\n" 
 2577                                         "    net_global_input : in STD_LOGIC := 'X';\n" 
 2580                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2584                                         "      key_invalid_type => Inv4lid_type\n"     
 2587                                         "      I => net_global_input\n" 
 2591                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2594                 EXPECT_TRUE(nl_res.is_error());
 
 2599                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2600                                         "entity TEST_Comp is\n" 
 2604                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2611                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2614                 ASSERT_TRUE(nl_res.is_ok());
 
 2615                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2616                 ASSERT_NE(nl, 
nullptr);
 
 2617                 ASSERT_FALSE(nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).empty());
 
 2618                 Gate* gate_0 = *nl->get_gates(test_utils::gate_filter(
"BUF", 
"gate_0")).begin();
 
 2625                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2626                                         "entity TEST_Comp is\n" 
 2628                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 2629                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 2632                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2633                                         "  attribute attri_name of gate_0 : label is attri_value;\n" 
 2637                                         "      I => net_global_in,\n" 
 2638                                         "      O => net_global_out\n" 
 2642                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2645                 ASSERT_TRUE(nl_res.is_ok());
 
 2646                 std::unique_ptr<Netlist> nl = nl_res.get();
 
 2648                 EXPECT_NE(nl, 
nullptr);
 
 2649                 ASSERT_EQ(nl->get_gates(test_utils::gate_type_filter(
"BUF")).size(), 1);
 
 2650                 Gate* attri_gate = *nl->get_gates(test_utils::gate_type_filter(
"BUF")).begin();
 
 2651                 EXPECT_EQ(attri_gate->
get_data(
"attribute", 
"attri_name"),
 
 2652                           std::make_tuple(
"unknown", 
"attri_value"));
 
 2657                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2658                                         "entity TEST_Comp is\n" 
 2660                                         "    net_global_in : in STD_LOGIC := 'X';\n" 
 2661                                         "    net_global_out : out STD_LOGIC := 'X';\n" 
 2664                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2665                                         "  attribute WAMBO;\n"     
 2669                                         "      I => net_global_in,\n" 
 2670                                         "      O => net_global_out\n" 
 2674                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2677                 EXPECT_TRUE(nl_res.is_error());
 
 2682                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2683                                         "entity TEST_Comp is\n" 
 2685                                         "    net_global_input : in STD_LOGIC := 'X';\n" 
 2688                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2689                                         "  signal n_vec : STD_LOGIC_VECTOR3 ( 0 to 1, 0 to 1);\n"     
 2693                                         "      O => net_global_input\n" 
 2697                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2700                 EXPECT_TRUE(nl_res.is_error());
 
 2704                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2705                                         "entity TEST_Comp is\n" 
 2709                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2710                                         "  signal l_vec : STD_LOGIC_VECTOR ( 0 to 3 );\n" 
 2714                                         "      DATA_OUT(0 to 2) => l_vec(0 to 3)\n" 
 2718                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2721                 EXPECT_TRUE(nl_res.is_error());
 
 2726                 std::string netlist_input(
"-- Device\t: device_name\n" 
 2727                                         "entity TEST_Comp is\n" 
 2731                                         "architecture STRUCTURE of TEST_Comp is\n" 
 2735                                         "      ADDR(1 to 3) => Unkn0wn_Format\n"     
 2739                 std::filesystem::path vhdl_file = test_utils::create_sandbox_file(
"netlist.v", netlist_input);
 
 2742                 EXPECT_TRUE(nl_res.is_error());
 
std::tuple< std::string, std::string > get_data(const std::string &category, const std::string &key) const
 
Net * get_fan_in_net(const std::string &pin_name) const
 
const std::vector< Net * > & get_fan_in_nets() const
 
Net * get_fan_out_net(const std::string &pin_name) const
 
const std::string & get_name() const
 
Endpoint * get_fan_in_endpoint(const std::string &pin_name) const
 
Endpoint * get_successor(const std::string &pin_name) const
 
const std::vector< Net * > & get_fan_out_nets() const
 
Endpoint * get_fan_out_endpoint(const std::string &pin_name) const
 
std::vector< ModulePin * > get_pins(const std::function< bool(ModulePin *)> &filter=nullptr) const
 
bool is_top_module() const
 
const std::vector< Gate * > & get_gates() const
 
std::string get_name() const
 
std::vector< Module * > get_submodules(const std::function< bool(Module *)> &filter=nullptr, bool recursive=false) const
 
std::string get_type() const
 
const std::unordered_set< Net * > & get_output_nets() const
 
const std::string & get_name() const
 
std::vector< Endpoint * > get_destinations(const std::function< bool(Endpoint *ep)> &filter=nullptr) const
 
bool is_global_input_net() const
 
std::vector< Endpoint * > get_sources(const std::function< bool(Endpoint *ep)> &filter=nullptr) const
 
Result< std::unique_ptr< Netlist > > parse_and_instantiate(const std::filesystem::path &file_path, const GateLibrary *gate_library)
 
GateLibrary * get_gate_library(const std::string &file_path)
 
CORE_API bool starts_with(const T &s, const T &start)
 
bool vectors_have_same_content(std::vector< T > vec_1, std::vector< T > vec_2)
 
TEST_F(HGLParserTest, check_library)