program_mult_manycore.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. @target : mipsjun
  2. @profile: `[
  3. {
  4. "stackBaseAddress" : 5888,
  5. "initFunction": "multiplica(0)",
  6. "id": "core0"
  7. },
  8. {
  9. "stackBaseAddress" : 6016,
  10. "initFunction": "multiplica(5)",
  11. "id": "core1"
  12. },
  13. {
  14. "stackBaseAddress" : 6144,
  15. "initFunction": "multiplica(10)",
  16. "id": "core2"
  17. },
  18. {
  19. "stackBaseAddress" : 6272,
  20. "initFunction": "multiplica(15)",
  21. "id": "core3"
  22. }
  23. ]`
  24. package main;
  25. const (
  26. LIN = 20
  27. COL = 20
  28. NUM_LINHAS_MULT = 5
  29. )
  30. var (
  31. matrizA [LIN][COL]int // `block:A`
  32. matrizB [LIN][COL]int // `block:A`
  33. matrizR [LIN][COL]int // `block:A`
  34. )
  35. func multiplica(initial int) {
  36. aux := 0
  37. limit := initial + NUM_LINHAS_MULT
  38. for i := initial; i < limit; i++ {
  39. for j := 0; j < COL; j++ {
  40. for k := 0; k < LIN; k++ {
  41. aux = aux + (matrizA[i][k] * matrizB[k][j])
  42. }
  43. matrizR[i][j] = aux
  44. aux = 0
  45. }
  46. }
  47. //x()
  48. }
  49. /**
  50. func x() int {
  51. return 1
  52. }
  53. */