Changeset 39 for PROJECT_CORE_MPI/CORE_MPI/BRANCHES/v0.01/PE.vhd
- Timestamp:
- Dec 7, 2012, 11:31:34 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PROJECT_CORE_MPI/CORE_MPI/BRANCHES/v0.01/PE.vhd
r35 r39 21 21 use IEEE.STD_LOGIC_1164.ALL; 22 22 library NocLib ; 23 library Std; 23 24 --use IEEE.STD_LOGIC_ARITH.ALL; 24 25 --use IEEE.STD_LOGIC_UNSIGNED.ALL; … … 26 27 use work.Packet_type.all; 27 28 use work.MPI_RMA.all; 29 use std.textio.all; 28 30 use IEEE.NUMERIC_STD.ALL; 29 31 … … 81 83 signal Lib_Init : std_logic; -- l'initialisation est terminée 82 84 --signaux pour la gestion de la MAE 83 type typ_mae is (start,Fillmem,NextFill,InitApp,InitCompleted,GetRank1,GetRank2,GetRank3,writeptr,InstrCopy, 84 putdata,putdata2,putcompleted,getdata,getdata2,getcompleted,terminate,st_timeout); 85 type typ_mae is (start,Fillmem,NextFill,InitApp,GetRank,WInCreate, putdata,getdata,WinCompleted,finalize,st_timeout); 85 86 signal dcount : natural range 0 to 255:=0; --permet de compter le packet de données envoyées 86 87 signal count,count_i : natural range 0 to 15:=0; … … 182 183 variable timeout,ct,dlen : natural range 0 to 255; 183 184 variable adrToset,SrcAdr,DestAdr : std_logic_vector(ADRLEN-1 downto 0); 185 variable mywin : Mpi_win; 184 186 variable iack : std_logic:='0'; 185 187 variable adresse,adresse_rd :natural range 0 to 65536; 186 188 variable status_reg,config_reg :std_logic_vector(Word-1 downto 0):=(others=>'0'); 189 --======================================================= 190 --variables pour la création du fichier de résultats 191 type char_file is file of character; 192 file f: text; 193 variable status :file_open_status ; 194 variable char_count: integer range 0 to 65536 := 0; 195 variable str: string (1 to 79) ; 196 variable L: line; 197 variable fopened: std_logic:='0'; 198 --====================================================== 187 199 begin 188 200 --=== Partie combinatoire du process =================================== … … 193 205 Libr.RamSel<=RamSel; 194 206 sram.data_out<=PE_ram_do; 195 --=== Fin de la partie combinatoire du process ========================== 207 --=== Fin de la partie combinatoire du process ========================== 208 209 210 211 --end loop; 212 196 213 if (clk'event and clk='1') then 197 214 if reset='1' then … … 220 237 timeout:=0; 221 238 dcount<=0; 239 if fopened='0' then 240 file_open(status,f, integer'image(destid) & "test_file0.txt", APPEND_MODE); 241 --while not endfile(c_file_handle) loop 242 --end if; 243 244 --write (l,string'("Ce fichier contient des resultats de la simulation ; ;" & " started at time ; " & time'image(now))); 245 --report l.all; 246 -- writeline (f, l) ; 247 fopened:='1'; 248 end if; 249 222 250 when Fillmem => 223 251 if Ramsel='0' then … … 256 284 when InitApp => 257 285 --code pour Init 258 286 dlen:=1; 287 if ct=0 then 288 write (l,string'("Dlen; ;INIT of Process n°; " & image(MyRank) & "; started at ; " & time'image(now))); 289 290 report l.all; 291 writeline (f, l) ; 292 end if; 259 293 pMPI_Init(ct,Libr,Clk,SRam); 260 294 PE_Instr_EN<=Libr.instr_en; … … 265 299 --if Libr.InitOk='1' then 266 300 if ct=0 then 267 RunState<=GetRank1; 301 RunState<=GetRank; 302 write (l,string'("Dlen; ;INIT;" & "; ended at ; " & time'image(now))); 303 report l.all; 304 writeline (f, l) ; 268 305 end if; 269 306 270 307 271 when writeptr => 272 273 When InstrCopy => 274 275 276 when InitCompleted => 277 278 when GetRank1 => 279 308 309 when GetRank => 310 if ct=0 then 311 312 write (l,string'("Dlen; ; Rank ; " & "; started ; " & time'image(now))); 313 report l.all; 314 writeline (f, l) ; 315 end if; 280 316 pMPI_Comm_rank(ct,Libr,sram,MPI_COMM_WORLD,MyRank); 317 adresse_rd:=to_integer(unsigned(sram.addr_rd)); 281 318 if ct=0 then 282 RunState<=PutData2; 319 RunState<=PutData; 320 write (l,string'("Dlen; ; Rank ; " & "; ended at ; " & time'image(now))); 321 report l.all; 322 writeline (f, l) ; 283 323 end if; 284 adresse_rd:=to_integer(unsigned(sram.addr_rd)); 285 286 when GetRank2 => 287 adresse_rd:=CORE_INIT_ADR+1; 288 if ramsel='0' then 289 RunState<=Getrank3; 290 end if; 291 when GetRank3=> 292 adresse_rd:=CORE_INIT_ADR+1; 293 if ramsel='0' then 294 RunState<=putdata2; 295 end if; 324 325 326 when Wincreate => 327 328 296 329 when putdata => --construire le packet pour le Put 297 330 298 299 when putdata2 => 300 331 --dlen:=251; --- 332 if ct=0 then 333 write (l,string'("Dlen;" & integer'image(dlen) & ";Put of Pr n°; " & image(MyRank) & "; started at ; " & time'image(now))); 334 report l.all; 335 writeline (f, l) ; 336 end if; 301 337 if unsigned(MyRank) = 0 then 302 338 Destrank:=1; … … 304 340 DestRank:=0; 305 341 end if; 306 dlen:=200; --- to_integer(unsigned(datalen));342 307 343 SrcAdr:=std_logic_vector(to_unsigned(DATAPTR,ADRLEN)); 308 344 DestAdr:=X"2000"; 309 345 310 pMPI_put(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr 1 & DestAdr,Dlen,Mpi_int,Default_win);346 pMPI_put(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr,Dlen,Mpi_int,Default_win); 311 347 adresse:=to_integer(unsigned(sram.addr_wr)); 312 348 adresse_rd:=to_integer(unsigned(sram.addr_rd)); … … 317 353 if ct=0 then 318 354 RunState<=GetData; 355 report "Put of Process n°; " & image(MyRank) & "; ended at ; " & time'image(now); 356 write (l,string'("Dlen;" & integer'image(dlen) & ";Put of Pr n°; " & image(MyRank) & "; ended at time ; " & time'image(now))); 357 report l.all; 358 writeline (f, l) ; 319 359 end if; 320 321 322 when putcompleted => 360 323 361 324 362 when getdata => --positionnement du mot de longueur des données 325 326 dlen:=200; --- to_integer(unsigned(datalen)); 363 --dlen:=251; --- 364 if ct=0 then 365 write (l,string'("Dlen;" & integer'image(dlen) & ";GET of Process n°; " & image(MyRank) & "; started at ; " & time'image(now))); 366 report l.all; 367 writeline (f, l) ; 368 end if; 369 327 370 SrcAdr:=X"0120"; 328 371 DestAdr:=X"4000"; 329 372 330 pMPI_GET(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr 1 & DestAdr,Dlen,Mpi_int,Default_win);373 pMPI_GET(ct,Libr,Clk,Sram,SrcAdr,Dlen,MPI_int,destrank,DestAdr,Dlen,Mpi_int,Default_win); 331 374 adresse:=to_integer(unsigned(sram.addr_wr)); 332 375 adresse_rd:=to_integer(unsigned(sram.addr_rd)); … … 336 379 337 380 if ct=0 then 338 RunState<=terminate; 381 RunState<=wincompleted; 382 assert ct/=0 report "GET_END " & integer'image(destrank) 383 severity Warning ; 384 write (l,string'("Dlen ;" & integer'image(dlen) & ";GET of Proc n°; " & image(MyRank) & "; ended at ; " & time'image(now))); 385 report l.all; 386 387 writeline (f, l) ; 339 388 end if; 340 when getdata2 => 341 342 343 344 345 when getcompleted => 346 347 389 390 when WinCompleted => 391 if ct=0 then 392 write (l,string'("Dlen ;" & integer'image(dlen) & ";Wait of Proc n°; " & image(MyRank) & "; started at ; " & time'image(now))); 393 report l.all; 394 writeline (f, l) ; 395 end if; 396 pMPI_Win_wait(ct,Libr,sram,MyWin ); 397 adresse:=to_integer(unsigned(sram.addr_wr)); 398 adresse_rd:=to_integer(unsigned(sram.addr_rd)); 399 if ct=0 then 400 RunState<=finalize; 401 write (l,string'("Dlen ;" & integer'image(dlen) & ";Wait of Proc n°; " & image(MyRank) & "; ended at ; " & time'image(now))); 402 report l.all; 403 writeline (f, l) ; 348 404 349 when terminate => 350 351 352 RunState<=start; 353 405 end if; 406 407 408 when finalize => 409 if ct=0 then 410 write (l,string'("Dlen ;" & integer'image(dlen) & ";Finalize of Proc n°; " & image(MyRank) & "; started at ; " & time'image(now))); 411 report l.all; 412 writeline (f, l) ; 413 end if; 414 415 if ct=0 then 416 RunState<=start; 417 write (l,string'("Dlen ;" & integer'image(dlen) & ";Finalize of Proc n°; " & image(MyRank) & "; ended at ; " & time'image(now))); 418 report l.all; 419 writeline (f, l) ; 420 file_close(f); 421 end if; 422 354 423 when st_timeout => 355 424 … … 397 466 PE_Ram_enb<=sram.enb; 398 467 399 when Initcompleted => 400 401 PE_Ram_ena<=Lib_Init; 402 PE_Ram_we<='1'; 403 PE_Ram_enb<='1'; 404 405 when GetRank1 => 468 469 when GetRank => 406 470 407 471 PE_Ram_we<=sram.we; 408 472 PE_Ram_ena<=sram.ena; 409 473 PE_Ram_enb<=sram.enb; 410 when GetRank2 => 411 PE_Ram_ena<='0'; 412 --lecture effective du rang 413 PE_Ram_enb<='1'; 414 --MyRank<=PE_ram_do(3 downto 0); 415 when GetRank3 => 416 PE_Ram_ena<='0'; 417 --lecture effective du rang 418 PE_Ram_enb<='1'; 419 --MyRank<=PE_ram_do(3 downto 0); 420 when writeptr => 421 PE_Ram_we <='1'; --écriture dans la RAM 422 PE_Ram_ena <='1'; 423 424 PE_Ram_enb <='0'; 425 -- dcount<=dcount+1; 426 427 --PE_Instr_En<='0'; 428 when InstrCopy => --instruction copy 429 PE_Ram_we<='0'; 430 PE_Ram_ena<='0'; 431 PE_Ram_enb<='0'; 432 433 434 when putdata => --positionnement du mot de longueur des données 435 --dcount<=0; 436 srcadr0<=X"00"; 437 srcadr1<=X"01"; 438 destadr0<=X"00"; 439 destadr1<=X"02"; 440 PE_Ram_we<='0'; 441 PE_Ram_ena<='0'; 442 443 PE_Ram_enb<='1'; 444 445 when putdata2 => 446 -- PE_Ram_we <='1'; --écriture dans la RAM 447 -- PE_Ram_ena <='1'; 448 -- PE_Ram_enb <='0'; 474 when WinCreate => 475 476 PE_Ram_we<=sram.we; 477 PE_Ram_ena<=sram.ena; 478 PE_Ram_enb<=sram.enb; 479 480 481 --positionnement du mot de longueur des données 482 483 484 when putdata => 449 485 srcadr0<=X"00"; 450 486 srcadr1<=X"01"; … … 454 490 PE_Ram_ena<=sram.ena; 455 491 PE_Ram_enb<=sram.enb; 456 457 when putcompleted => 458 PE_Ram_we <='1'; 459 PE_Ram_ena <='1'; 460 -- lecture du résultat 461 PE_Ram_enb <='1'; 462 --PE_Instr_En<='1'; 492 463 493 when getdata => 464 494 PE_Ram_we<=sram.we; 465 495 PE_Ram_ena<=sram.ena; 466 496 PE_Ram_enb<=sram.enb; 467 468 469 when getdata2 => 470 PE_Ram_we <='1'; --écriture dans la RAM 471 PE_Ram_ena <='1'; 472 473 PE_Ram_enb <='0'; 474 475 when getcompleted => 476 PE_Ram_we <='1'; 477 PE_Ram_ena <='1'; 478 479 PE_Ram_enb <='1'; 480 481 when terminate => 497 498 when Wincompleted => 499 PE_Ram_we<=sram.we; 500 PE_Ram_ena<=sram.ena; 501 PE_Ram_enb<=sram.enb; 502 503 when finalize => 482 504 483 505 PE_Ram_we<='0';
Note: See TracChangeset
for help on using the changeset viewer.