Beispiel #1
0
tmpl(/**/)::VciTimer(
    sc_module_name name,
    const IntTab &index,
    const MappingTable &mt,
    size_t nirq)
	: caba::BaseModule(name),
	  m_vci_fsm(p_vci, mt.getSegmentList(index)),
      m_ntimer(nirq),
      r_value(soclib::common::alloc_elems<sc_signal<typename vci_param::data_t> >("value", m_ntimer)),
      r_period(soclib::common::alloc_elems<sc_signal<typename vci_param::data_t> >("period", m_ntimer)),
      r_counter(soclib::common::alloc_elems<sc_signal<typename vci_param::data_t> >("counter", m_ntimer)),
      r_mode(soclib::common::alloc_elems<sc_signal<int> >("mode", m_ntimer)),
      r_irq(soclib::common::alloc_elems<sc_signal<bool> >("saved_irq", m_ntimer)),
      p_clk("clk"),
      p_resetn("resetn"),
      p_vci("vci"),
      p_irq(soclib::common::alloc_elems<sc_out<bool> >("irq", m_ntimer))
{
	m_vci_fsm.on_read_write(on_read, on_write);

	SC_METHOD(transition);
	dont_initialize();
	sensitive << p_clk.pos();

	SC_METHOD(genMoore);
	dont_initialize();
	sensitive << p_clk.neg();
}
Beispiel #2
0
tmpl(/**/)::VciBlockDevice(
    sc_module_name name,
    const MappingTable &mt,
    const IntTab &srcid,
    const IntTab &tgtid,
    const std::string &filename,
    const uint32_t block_size, 
    const uint32_t latency)
	: caba::BaseModule(name),
	  m_vci_target_fsm(p_vci_target, mt.getSegmentList(tgtid)),
	  m_vci_init_fsm(p_vci_initiator, mt.indexForId(srcid)),
      m_block_size(block_size),
      m_latency(latency),
      p_clk("clk"),
      p_resetn("resetn"),
      p_vci_target("vci_target"),
      p_vci_initiator("vci_initiator"),
      p_irq("irq")
{
	m_vci_target_fsm.on_read_write(on_read, on_write);

    m_fd = ::open(filename.c_str(), O_RDWR);
    if ( m_fd < 0 ) {
        std::cerr << "Unable to open block device image file " << filename << std::endl;
        m_device_size = 0;
    } else {
        m_device_size = lseek(m_fd, 0, SEEK_END) / m_block_size;
        if ( m_device_size > ((uint64_t)1<<(vci_param::B*8)) ) {
            std::cerr
                << "Warning: block device " << filename
                << " has more blocks than addressable with "
                << (8*vci_param::B) << "." << std::endl;
            m_device_size = ((uint64_t)1<<(vci_param::B*8));
        }
    }
#ifdef SOCLIB_MODULE_DEBUG
    std::cout 
        << name
        << " = Opened " 
        << filename
        << " which has "
        << m_device_size
        << " blocks of "
        << m_block_size
        << " bytes"
        << std::endl;
#endif

	SC_METHOD(transition);
	dont_initialize();
	sensitive << p_clk.pos();

	SC_METHOD(genMoore);
	dont_initialize();
	sensitive << p_clk.neg();
}
Beispiel #3
0
tmpl(/**/)::VciXicu( sc_core::sc_module_name name,
                     const MappingTable      &mt,
                     const                   IntTab &index,
                     size_t                  pti_count,
                     size_t                  hwi_count,
                     size_t                  wti_count,
                     size_t                  irq_count )
           : caba::BaseModule(name),
           m_seglist( mt.getSegmentList(index) ),
           m_pti_count( pti_count ),
           m_hwi_count( hwi_count ),
           m_wti_count( wti_count ),
           m_irq_count( irq_count ),

           r_fsm( "r_fsm" ),
           r_data( "r_data" ),
           r_srcid( "r_srcid" ),
           r_trdid( "r_trdid" ),
           r_pktid( "r_pktid" ),
           r_msk_pti( alloc_elems<sc_signal<uint32_t> >("r_msk_pti" , irq_count) ),
           r_msk_wti( alloc_elems<sc_signal<uint32_t> >("r_msk_wti" , irq_count) ),
           r_msk_hwi( alloc_elems<sc_signal<uint32_t> >("r_msk_hwi" , irq_count) ),
           r_pti_pending( "r_pti_pending" ),
           r_wti_pending( "r_wti_pending" ),
           r_hwi_pending( "r_hwi_pending" ),
           r_pti_per( alloc_elems<sc_signal<uint32_t> >("r_pti_per" , pti_count) ),
           r_pti_val( alloc_elems<sc_signal<uint32_t> >("r_pti_val" , pti_count) ),
           r_wti_reg( alloc_elems<sc_signal<uint32_t> >("r_wti_reg" , wti_count) ),

           p_clk( "clk" ),
           p_resetn( "resetn" ),
           p_vci( "vci" ),
           p_irq( alloc_elems<sc_core::sc_out<bool> >("irq", irq_count) ),
           p_hwi( alloc_elems<sc_core::sc_in<bool> >("hwi", hwi_count) )
{
    std::cout << "  - Building VciXicu : " << name << std::endl;

    std::list<soclib::common::Segment>::iterator seg;
    for ( seg = m_seglist.begin() ; seg != m_seglist.end() ; seg++ )
    {
        std::cout << "    => segment " << seg->name()
                  << " / base = " << std::hex << seg->baseAddress()
                  << " / size = " << seg->size() << std::endl; 
    }
 
	SC_METHOD(transition);
	dont_initialize();
	sensitive << p_clk.pos();

	SC_METHOD(genMoore);
	dont_initialize();
	sensitive << p_clk.neg();
}