21 cci::cci_param<std::string> p_mac;
22 std::string m_netdev_id;
23 cci::cci_param<std::string> p_netdev_str;
30 opencores_eth(
const sc_core::sc_module_name& name, sc_core::sc_object* o)
34 opencores_eth(
const sc_core::sc_module_name& n,
QemuInstance& inst)
36 , p_mac(
"mac",
"00:11:22:33:44:55",
"MAC address of NIC")
37 , m_netdev_id(std::string(name()) +
"-id")
38 , p_netdev_str(
"netdev_str",
"user,hostfwd=tcp::2222-:22",
"netdev string for QEMU (do not specify ID)")
39 , regs_socket(
"regs", inst)
40 , desc_socket(
"desc", inst)
43 std::stringstream opts;
44 opts << p_netdev_str.get_value();
45 opts <<
",id=" << m_netdev_id;
47 m_inst.add_arg(
"-netdev");
48 m_inst.add_arg(opts.str().c_str());
51 void before_end_of_elaboration()
override
53 QemuDevice::before_end_of_elaboration();
55 m_dev.set_prop_str(
"mac", p_mac.get_value().c_str());
56 m_dev.set_prop_str(
"netdev", m_netdev_id.c_str());
59 void end_of_elaboration()
override
61 QemuDevice::end_of_elaboration();
65 regs_socket.init(sbd, 0);
66 desc_socket.init(sbd, 1);
67 irq_out.init_sbd(sbd, 0);