
# -*- python -*-

__id__ = "$Id: vci_io_bridge.sd 20 2012-6-11 $"

Module('caba:vci_io_bridge',
	classname = 'soclib::caba::VciIoBridge',
	tmpl_parameters = [ 
        parameter.Module('vci_param_d', default = 'caba:vci_param',
                            cell_size   = parameter.Reference("cell_size_d"),
                            plen_size   = parameter.Reference("plen_size_d"),
                            addr_size   = parameter.Reference("addr_size_d"),
                            rerror_size = parameter.Reference("rerror_size_d"),
                            clen_size   = parameter.Reference("clen_size_d"),  
                            rflag_size  = parameter.Reference("rflag_size_d"), 
                            srcid_size  = parameter.Reference("srcid_size_d"),
                            pktid_size  = parameter.Reference("pktid_size_d"),
                            trdid_size  = parameter.Reference("trdid_size_d"),
                            wrplen_size = parameter.Reference("wrplen_size_d")),
	    parameter.Module('vci_param_x', default = 'caba:vci_param',
                            cell_size   = parameter.Reference("cell_size_x"),
                            plen_size   = parameter.Reference("plen_size_x"),
                            addr_size   = parameter.Reference("addr_size_x"),
                            rerror_size = parameter.Reference("rerror_size_x"),
                            clen_size   = parameter.Reference("clen_size_x"),  
                            rflag_size  = parameter.Reference("rflag_size_x"), 
                            srcid_size  = parameter.Reference("srcid_size_x"),
                            pktid_size  = parameter.Reference("pktid_size_x"),
                            trdid_size  = parameter.Reference("trdid_size_x"),
                            wrplen_size = parameter.Reference("wrplen_size_x")),
        parameter.Module('vci_param_io', default = 'caba:vci_param', 
                            cell_size   = parameter.Reference("cell_size_io"),
                            plen_size   = parameter.Reference("plen_size_io"),
                            addr_size   = parameter.Reference("addr_size_io"),
                            rerror_size = parameter.Reference("rerror_size_io"),
                            clen_size   = parameter.Reference("clen_size_io"),  
                            rflag_size  = parameter.Reference("rflag_size_io"), 
                            srcid_size  = parameter.Reference("srcid_size_io"),
                            pktid_size  = parameter.Reference("pktid_size_io"),
                            trdid_size  = parameter.Reference("trdid_size_io"),
                            wrplen_size = parameter.Reference("wrplen_size_io")),
    ],
	header_files =         [ '../source/include/vci_io_bridge.h',
	                         '../source/include/transaction_tab_io.h'],
	implementation_files = [ '../source/src/vci_io_bridge.cpp' ],
	uses = [ Uses('caba:base_module'),
	         Uses('common:mapping_table'),
	         Uses('caba:generic_fifo'),
	         Uses('caba:generic_tlb', 
                       addr_t = parameter.StringExt('sc_dt::sc_uint<%d> ', 
                       parameter.Reference('addr_size'))),
 	         Uses('common:address_decoding_table', 
                       input_t  = 'unsigned long',
                       output_t = 'bool'),
 	         Uses('common:address_decoding_table', 
                       input_t  = 'unsigned long',
                       output_t = 'int'),
#	         Uses('common:address_masking_table', 
#                       data_t = parameter.StringExt('sc_dt::sc_uint<%d> ', 
#                       parameter.Reference('addr_size'))),
           ],
	ports = [ Port('caba:vci_initiator', 'p_vci_ini_dma'),
	          Port('caba:vci_target', 'p_vci_tgt_dma'),
              Port('caba:vci_initiator', 'p_vci_ini_config'),
	          Port('caba:vci_target', 'p_vci_tgt_config'),
              Port('caba:vci_initiator', 'p_vci_ini_miss'),
	          Port('caba:bit_in','p_irq', parameter.Reference('nb_periph')),
	          Port('caba:bit_in', 'p_resetn', auto = 'resetn'),
	          Port('caba:clock_in', 'p_clk', auto = 'clock'), ],
	instance_parameters = [ parameter.Int('nd_periph'),
	                        parameter.Module('mtx', 'common:mapping_table'),
	                        parameter.Module('mtd', 'common:mapping_table'),
	                        parameter.Module('mtio', 'common:mapping_table'),
	                        parameter.Module('seg_config_iob', 'common:segment'), 
                            parameter.IntTab('tgt_index_iocluster'),
#	                        parameter.IntTab('tgt_index_config'),
	                        parameter.IntTab('init_index_direct'),
	                        parameter.IntTab('tgt_index_iospace'),
	                        parameter.IntTab('init_index_iospace'),
	                        parameter.IntTab('init_index_dma'),
    	                        parameter.Int('dcache_words'),
    	                        parameter.Int('iotlb_ways'),
    	                        parameter.Int('iotlb_sets'),
    	                        parameter.Int('max_frozen_cycles'), ],
	extensions = [ 'dsx:get_ident='
                       'tgt_index_config:p_vci_tgt_config:mtd,'
                       'init_index_direct:p_vci_init_miss:mtd,'
                       'tgt_index_iospace:p_vci_tgt_dma:mtio,'
                       'init_index_iospace:p_vci_init_config:mtio,'
                       'init_index_dma:p_vci_ini_dma:mtx,'
	               'dsx:cpu=wrapper:iss_t',
	               'dsx:addressable=tgt_index_config,tgt_index_iospace',
#                       'dsx:on_segment=mc:add_index:initiator_rw_index',
	               ],

#       debug = True,
)

