Changeset 145 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_vhdl_body.cpp
- Timestamp:
- Oct 13, 2010, 8:15:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_vhdl_body.cpp
r101 r145 17 17 void RegisterFile_Monolithic::vhdl_body (Vhdl * & vhdl) 18 18 { 19 #ifndef VHDL_GAISLER 20 19 21 vhdl->set_body (0,""); 20 22 vhdl->set_comment(0,"---------------------------------------------------------------------------"); … … 107 109 if (_param->_have_init_value) 108 110 vhdl->set_body (1,"end if;"); 109 110 111 vhdl->set_body (0,"end process RegisterFile_write;"); 112 113 #else 114 // vhdl->set_body (0,""); 115 // vhdl->set_comment(0,"---------------------------------------------------------------------------"); 116 // vhdl->set_comment(0," Ackitement"); 117 // vhdl->set_comment(0,"---------------------------------------------------------------------------"); 118 // vhdl->set_body (0,""); 119 120 // for (uint32_t i = 0; i < _param->_nb_port_read; i++) 121 // vhdl->set_body (0,"out_READ_"+toString(i)+"_ACK <= '1';"); 122 // for (uint32_t i = 0; i < _param->_nb_port_write; i++) 123 // vhdl->set_body (0,"out_WRITE_"+toString(i)+"_ACK <= '1';"); 124 // for (uint32_t i = 0; i < _param->_nb_port_read_write; i++) 125 // vhdl->set_body (0,"out_READ_WRITE_"+toString(i)+"_ACK <= '1';"); 126 127 // vhdl->set_body (0,""); 128 // vhdl->set_comment(0,"---------------------------------------------------------------------------"); 129 // vhdl->set_comment(0," Read RegisterFile"); 130 // vhdl->set_comment(0,"---------------------------------------------------------------------------"); 131 // vhdl->set_body (0,""); 132 133 // for (uint32_t num_read=0; num_read<_param->_nb_port_read; ++num_read) 134 // { 135 // vhdl->set_body (0,"with in_READ_"+toString(num_read)+"_ADDRESS select"); 136 // vhdl->set_body (1,"out_READ_"+toString(num_read)+"_DATA <="); 137 // for (uint32_t num_word=0; num_word<_param->_nb_word-1; ++num_word) 138 // vhdl->set_body (1,"reg_DATA_"+toString(num_word)+" when "+std_logic_cst(_param->_size_address,num_word)+","); 139 // vhdl->set_body (1,"reg_DATA_"+toString(_param->_nb_word-1)+" when others;"); 140 // } 141 142 // vhdl->set_body (0,""); 143 // vhdl->set_comment(0,"---------------------------------------------------------------------------"); 144 // vhdl->set_comment(0," Write RegisterFile"); 145 // vhdl->set_comment(0,"---------------------------------------------------------------------------"); 146 // vhdl->set_body (0,""); 147 148 // vhdl->set_body (0,"RegisterFile_write: process (in_CLOCK)"); 149 // vhdl->set_body (0,"begin -- process RegisterFile_write"); 150 // vhdl->set_body (1,"if in_CLOCK'event and in_CLOCK = '1' then"); 151 152 // for (uint32_t num_write = 0; num_write < _param->_nb_port_write; num_write++) 153 // { 154 // vhdl->set_body (2,"if (in_WRITE_"+toString(num_write)+"_VAL = '1') then"); 155 // for (uint32_t num_word=0; num_word<_param->_nb_word; ++num_word) 156 // { 157 // vhdl->set_body (3,"if (in_WRITE_"+toString(num_write)+"_ADDRESS = "+std_logic_cst(_param->_size_address,num_word)+") then"); 158 // vhdl->set_body (4,"reg_DATA_"+toString(num_word)+" <= in_WRITE_"+toString(num_write)+"_DATA;"); 159 // vhdl->set_body (3,"end if;"); 160 // } 161 // vhdl->set_body (2,"end if;"); 162 // } 163 164 // vhdl->set_body (1,"end if;"); 165 // vhdl->set_body (0,"end process RegisterFile_write;"); 166 167 vhdl->set_body (0,"combinatory : process ("); 168 for (uint32_t num_read=0; num_read<_param->_nb_port_read; ++num_read) 169 { 170 vhdl->set_body (1,"in_READ_"+toString(num_read)+"_VAL,"); 171 if (_param->_have_port_address) 172 vhdl->set_body (1,"in_READ_"+toString(num_read)+"_ADDRESS,"); 173 } 174 for (uint32_t num_write=0; num_write<_param->_nb_port_write; ++num_write) 175 { 176 vhdl->set_body (1,"in_WRITE_"+toString(num_write)+"_VAL,"); 177 if (_param->_have_port_address) 178 vhdl->set_body (1,"in_WRITE_"+toString(num_write)+"_ADDRESS,"); 179 vhdl->set_body (1,"in_WRITE_"+toString(num_write)+"_DATA,"); 180 } 181 for (uint32_t num_write = 0; num_write < _param->_nb_port_write; num_write++) 182 vhdl->set_body (1,"in_NRESET,"); 183 vhdl->set_body (1,"reg_DATA)"); 184 vhdl->set_body (1,"variable sig_DATA : Treg;"); 185 vhdl->set_body (0,"begin"); 186 vhdl->set_body (1,""); 187 vhdl->set_body (1,"sig_DATA := reg_DATA;"); 188 189 vhdl->set_body (1,""); 190 vhdl->set_body (1," -- ack"); 191 vhdl->set_body (1,""); 192 193 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 194 vhdl->set_body (1,"out_READ_"+toString(i)+"_ACK <= '1';"); 195 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 196 vhdl->set_body (1,"out_WRITE_"+toString(i)+"_ACK <= '1';"); 197 for (uint32_t i = 0; i < _param->_nb_port_read_write; i++) 198 vhdl->set_body (1,"out_READ_WRITE_"+toString(i)+"_ACK <= '1';"); 199 vhdl->set_body (1,""); 200 vhdl->set_body (1," -- Read"); 201 vhdl->set_body (1,""); 202 203 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 204 { 205 std::string str_address; 206 if (_param->_have_port_address) 207 str_address = "conv_integer(in_READ_"+toString(i)+"_ADDRESS)"; 208 else 209 str_address = "0"; 210 211 vhdl->set_body (1,"if (in_READ_"+toString(i)+"_VAL = '1') then"), 212 vhdl->set_body (2,"out_READ_"+toString(i)+"_DATA <= sig_DATA.reg ("+str_address+");"); 213 vhdl->set_body (1,"else"), 214 vhdl->set_body (2,"out_READ_"+toString(i)+"_DATA <= "+std_logic_others(_param->_size_word,0)+";"); 215 vhdl->set_body (1,"end if;"); 216 } 217 vhdl->set_body (1,""); 218 vhdl->set_body (1," -- write"); 219 vhdl->set_body (1,""); 220 221 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 222 { 223 std::string str_address; 224 if (_param->_have_port_address) 225 str_address = "conv_integer(in_WRITE_"+toString(i)+"_ADDRESS)"; 226 else 227 str_address = "0"; 228 229 vhdl->set_body (1,"if (in_WRITE_"+toString(i)+"_VAL = '1') then"); 230 vhdl->set_body (2,"sig_DATA.reg("+str_address+") := in_WRITE_"+toString(i)+"_DATA;"); 231 vhdl->set_body (1,"end if;"); 232 } 233 234 vhdl->set_body (1,""); 235 vhdl->set_body (1,"reg_DATA_next <= sig_DATA;"); 236 vhdl->set_body (1,""); 237 vhdl->set_body (0,"end process combinatory;"); 238 239 240 vhdl->set_body (0,"sequential: process (in_CLOCK)"); 241 vhdl->set_body (0,"begin"); 242 vhdl->set_body (1,"if rising_edge(in_CLOCK) then"); 243 vhdl->set_body (2,"reg_DATA <= reg_DATA_NEXT;"); 244 vhdl->set_body (1,"end if;"); 245 vhdl->set_body (0,"end process sequential;"); 246 247 #endif 248 111 249 }; 112 250
Note: See TracChangeset
for help on using the changeset viewer.