- Timestamp:
- Oct 4, 2010, 5:37:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/platforms/caba-vdspin-vci_synthetic_initiator/top.cpp
r99 r103 1 1 2 #include <stdint.h> 2 3 #include <systemc> 3 4 #include <sys/time.h> … … 6 7 #include <cstdarg> 7 8 9 #include "arithmetics.h" 8 10 #include "mapping_table.h" 9 11 #include "alloc_elems.h" 10 //#include "vci_simple_ram.h"12 #include "vci_simple_ram.h" 11 13 //#include "vci_multi_tty.h" 12 14 #include "vci_local_ring_fast.h" … … 39 41 40 42 // Define VCI parameters 41 typedef soclib::caba::VciParams<4,8,32,1,1,1,8,4,4,1> vci_param; 42 43 typedef soclib::caba::VciParams<4,8,40,1,1,1,8,4,4,1> vci_param; 44 45 46 soclib::common::Loader loader(NULL); 43 47 // Mapping table primary network 44 45 soclib::common::MappingTable maptab (32, IntTab(2,10), IntTab(2,3), 0x00C00000);46 47 48 maptab.add(Segment("mc_r0" , MC0_R_BASE , MC0_R_SIZE , IntTab(0,0), false, true, IntTab(0,0))); 49 maptab.add(Segment("mc_m0" , MC0_M_BASE , MC0_M_SIZE , IntTab(0,0), true));50 maptab.add(Segment("mc_r1" , MC1_R_BASE , MC1_R_SIZE , IntTab(1,0), false, true, IntTab(1,0)));51 maptab.add(Segment("mc_m1" , MC1_M_BASE , MC1_M_SIZE , IntTab(1,0), true));52 maptab.add(Segment("mc_r2" , MC2_R_BASE , MC2_R_SIZE , IntTab(2,0), false, true, IntTab(2,0)));53 maptab.add(Segment("mc_m2" , MC2_M_BASE , MC2_M_SIZE , IntTab(2,0), true));54 maptab.add(Segment("mc_r3" , MC3_R_BASE , MC3_R_SIZE , IntTab(3,0), false, true, IntTab(3,0)));55 maptab.add(Segment("mc_m3" , MC3_M_BASE , MC3_M_SIZE , IntTab(3,0), true));56 57 std::cout << maptab << std::endl; 58 48 49 soclib::common::MappingTable maptab0(40, IntTab(2,10), IntTab(2,3), 0x00C00000); 50 soclib::common::MappingTable maptab1(40, IntTab(2,10), IntTab(2,3), 0x00C00000); 51 52 53 //maptab0.add(Segment("mc_r0" , MC0_R_BASE , MC0_R_SIZE , IntTab(0,0), false, true, IntTab(0,0))); 54 //maptab0.add(Segment("mc_m0" , MC0_M_BASE , MC0_M_SIZE , IntTab(0,0), true )); 55 //maptab0.add(Segment("mc_r1" , MC1_R_BASE , MC1_R_SIZE , IntTab(1,0), false, true, IntTab(1,0))); 56 //maptab0.add(Segment("mc_m1" , MC1_M_BASE , MC1_M_SIZE , IntTab(1,0), true )); 57 //maptab0.add(Segment("mc_r2" , MC2_R_BASE , MC2_R_SIZE , IntTab(2,0), false, true, IntTab(2,0))); 58 //maptab0.add(Segment("mc_m2" , MC2_M_BASE , MC2_M_SIZE , IntTab(2,0), true )); 59 //maptab0.add(Segment("mc_r3" , MC3_R_BASE , MC3_R_SIZE , IntTab(3,0), false, true, IntTab(3,0))); 60 //maptab0.add(Segment("mc_m3" , MC3_M_BASE , MC3_M_SIZE , IntTab(3,0), true )); 61 62 std::cout << maptab0 << std::endl; 59 63 // Signals 60 64 … … 62 66 sc_signal<bool> signal_resetn("resetn"); 63 67 64 soclib::caba::VciSignals<vci_param> * signal_vci_ini_synth_c0 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", N_CLUSTERS);65 soclib::caba::VciSignals<vci_param> * signal_vci_ini_synth_c1 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", N_CLUSTERS);68 soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c0 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", 2, N_CLUSTERS); 69 soclib::caba::VciSignals<vci_param> ** signal_vci_ini_synth_c1 = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_ini_synth", 2, N_CLUSTERS); 66 70 /////////////////////////////////////////////////////////////// 67 71 // VDSPIN Signals : one level for in and out, one level for X length in the mesh, 68 72 // one level for Y length in the mesh, last level for each port of the router 69 73 /////////////////////////////////////////////////////////////// 70 soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c0 = soclib::common::alloc_elems<so lib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_0", 2, Y_MAX, X_MAX, 5 );71 soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c1 = soclib::common::alloc_elems<so lib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_1", 2, Y_MAX, X_MAX, 5 );72 soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c0 = soclib::common::alloc_elems<so lib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_0", 2, Y_MAX, X_MAX, 5 );73 soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c1 = soclib::common::alloc_elems<so lib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_2", 2, Y_MAX, X_MAX, 5 );74 soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c0 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_0", 2, Y_MAX, X_MAX, 5 ); 75 soclib::caba::DspinSignals<WIDTH_CMD> **** dspin_signals_cmd_c1 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_CMD> >("Dspin_cmd_signals_channel_1", 2, Y_MAX, X_MAX, 5 ); 76 soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c0 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_0", 2, Y_MAX, X_MAX, 5 ); 77 soclib::caba::DspinSignals<WIDTH_RSP> **** dspin_signals_rsp_c1 = soclib::common::alloc_elems<soclib::caba::DspinSignals<WIDTH_RSP> >("Dspin_rsp_signals_channel_2", 2, Y_MAX, X_MAX, 5 ); 74 78 75 79 //soclib::caba::VciSignals<vci_param> * signal_vci_tgt_proc = soclib::common::alloc_elems<soclib::caba::VciSignals<vci_param> >("signal_vci_tgt_proc", N_CLUSTERS); … … 77 81 // N_CLUSTERS ring. 78 82 soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> * local_ring_c0 = (soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> *) malloc(sizeof(soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ) * N_CLUSTERS) ; 79 for(int i = 0 ; i < N_CLUSTERS ; i++){ // ringid, fifo, fifo, nb_init, nb_tgt80 new(&local_ring_c0[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c0" + i,maptab, IntTab(i), 2, 18, 1, 1)81 }82 83 83 soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> * local_ring_c1 = (soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> *) malloc(sizeof(soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ) * N_CLUSTERS) ; 84 84 for(int i = 0 ; i < N_CLUSTERS ; i++){ // ringid, fifo, fifo, nb_init, nb_tgt 85 new(&local_ring_c1[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c1" + i,maptab, IntTab(i), 2, 18, 1, 1) 85 new(&local_ring_c0[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c0" + i,maptab0, IntTab(i), 2, 18, 1, 1); 86 new(&local_ring_c1[i]) soclib::caba::VciLocalRingFast<vci_param, WIDTH_CMD, WIDTH_RSP> ("cluster_c1" + i,maptab1, IntTab(i), 2, 18, 1, 1); 86 87 } 87 88 … … 106 107 // N_CLUSTERS VCI Synthetic Initiator (1 initiator per cluster/network) 107 108 soclib::caba::VciSyntheticInitiator<vci_param> * initiator_c0 = (soclib::caba::VciSyntheticInitiator<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticInitiator<vci_param> )* N_CLUSTERS); 108 for(int i = 0 ; i < Y_MAX; i++)109 for(int j = 0 ; j < Y_MAX ; j++)110 new(&initiator_c0[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c0" + (i*X_MAX+j), i*X_MAX+j, maptab, IntTab(i,j),16, 0.5, 2, X_MAX, Y_MAX);111 112 109 soclib::caba::VciSyntheticInitiator<vci_param> * initiator_c1 = (soclib::caba::VciSyntheticInitiator<vci_param> *) malloc(sizeof(soclib::caba::VciSyntheticInitiator<vci_param> )* N_CLUSTERS); 113 110 for(int i = 0 ; i < Y_MAX; i++) 114 for(int j = 0 ; j < Y_MAX ; j++) 115 new(&initiator_c1[Y_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c1" + (i*X_MAX+j), i*X_MAX+j, maptab, IntTab(i,j),16, 0.5, 2, X_MAX, Y_MAX); 111 for(int j = 0 ; j < X_MAX ; j++){ 112 new(&initiator_c0[X_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c0" + (i*X_MAX+j), maptab0, IntTab(i,j), 16, 0.5, 2, X_MAX, Y_MAX ); //, 0, 0, 0, 0, 0); 113 new(&initiator_c1[X_MAX*i+j]) soclib::caba::VciSyntheticInitiator<vci_param> ("Initiator_c1" + (i*X_MAX+j), maptab0, IntTab(i,j), 16, 0.5, 2, X_MAX, Y_MAX ); //, 0, 0, 0, 0, 0); 114 } 115 116 soclib::caba::VciSimpleRam<vci_param> * ram_c0 = (soclib::caba::VciSimpleRam<vci_param> *) malloc(sizeof(soclib::caba::VciSimpleRam<vci_param>) * N_CLUSTERS); 117 soclib::caba::VciSimpleRam<vci_param> * ram_c1 = (soclib::caba::VciSimpleRam<vci_param> *) malloc(sizeof(soclib::caba::VciSimpleRam<vci_param>) * N_CLUSTERS); 118 for(int i = 0 ; i < Y_MAX ; i++) 119 for(int j = 0 ; j < X_MAX ; j++){ 120 new(&ram_c0[X_MAX*i+j]) soclib::caba::VciSimpleRam<vci_param> ("Ram_target_c0" + (i*X_MAX+j), IntTab(i,j), maptab0, loader, 0); 121 new(&ram_c1[X_MAX*i+j]) soclib::caba::VciSimpleRam<vci_param> ("Ram_target_c1" + (i*X_MAX+j), IntTab(i,j), maptab1, loader, 0); 122 } 116 123 117 124 /////////////////////////////////////////////////////////////// … … 121 128 local_ring_c0[i].p_clk(signal_clk); 122 129 local_ring_c0[i].p_resetn(signal_resetn); 123 local_ring_c0[i].p_to_initiator[0](signal_vci_ini_synt_c0h[i]); 130 local_ring_c0[i].p_to_initiator[0](signal_vci_ini_synth_c0[0][i]); 131 local_ring_c0[i].p_to_target[0](signal_vci_ini_synth_c0[1][i]); 124 132 initiator_c0[i].p_clk(signal_clk); 125 133 initiator_c0[i].p_resetn(signal_resetn); 126 initiator_c0[i].p_vci(signal_vci_ini_synth_c0[i]); 134 initiator_c0[i].p_vci(signal_vci_ini_synth_c0[0][i]); 135 ram_c0[i].p_clk(signal_clk); 136 ram_c0[i].p_resetn(signal_resetn); 137 ram_c0[i].p_vci(signal_vci_ini_synth_c0[1][i]); 127 138 local_ring_c1[i].p_clk(signal_clk); 128 139 local_ring_c1[i].p_resetn(signal_resetn); 129 local_ring_c1[i].p_to_initiator[0](signal_vci_ini_synth_c1[i]); 140 local_ring_c1[i].p_to_initiator[0](signal_vci_ini_synth_c1[0][i]); 141 local_ring_c1[i].p_to_target[0](signal_vci_ini_synth_c1[1][i]); 130 142 initiator_c1[i].p_clk(signal_clk); 131 143 initiator_c1[i].p_resetn(signal_resetn); 132 initiator_c1[i].p_vci(signal_vci_ini_synth_c1[i]); 144 initiator_c1[i].p_vci(signal_vci_ini_synth_c1[0][i]); 145 ram_c1[i].p_clk(signal_clk); 146 ram_c1[i].p_resetn(signal_resetn); 147 ram_c1[i].p_vci(signal_vci_ini_synth_c1[1][i]); 133 148 } 134 149 … … 151 166 local_ring_c1[i*X_MAX+j].p_gate_rsp_in( dspin_signals_rsp_c1[0][i][j][LOCAL]); 152 167 local_ring_c1[i*X_MAX+j].p_gate_rsp_out(dspin_signals_rsp_c1[1][i][j][LOCAL] ); 153 for( k = 0; k < 5; k++){168 for(int k = 0; k < 5; k++){ 154 169 if(i == 0){ 155 170 if(j == 0){
Note: See TracChangeset
for help on using the changeset viewer.