TestGpo.Mdf 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. cellnet TestGpo;
  2. import
  3. Engines;
  4. type
  5. Controller = cell{Arch="Xc7zPs"}
  6. (
  7. gpoOut: port out;
  8. clock0: port out;
  9. resetn0: port out
  10. );
  11. begin
  12. end Controller;
  13. var
  14. ctl: Controller;
  15. gpo{DataWidth=8}: Engines.Gpo;
  16. systemClock: Engines.SystemClock;
  17. systemReset: Engines.SystemReset;
  18. begin
  19. new(ctl);
  20. new(systemClock);
  21. new(systemReset);
  22. connect(ctl.clock0,systemClock.input,0);
  23. connect(ctl.resetn0,systemReset.input,0);
  24. new(gpo);
  25. connect(ctl.gpoOut,gpo.input,0);
  26. end TestGpo.
  27. ActiveCellsComponents.AddPath "ActiveCells-HWL"~
  28. Compiler.Compile -b=TRM --objectFile=Intermediate --activeCells
  29. oc/TRM.TRMRuntime.Mod
  30. oc/TRM.Heaps.Mdf
  31. Fox/AxisChannels.Mod
  32. Fox/Engines.Mdf
  33. ARM.A2/TestGpo.Mdf
  34. ~
  35. ActiveCellsComponents.BuildHardware --target="ActiveCells-HWL/Zedboard-Hybrid.achc.xml" --outputPath="TestGpo" TestGpo ~
  36. (*
  37. This is an example how to access GPO from ARM on Zynq
  38. *)
  39. module TestGpo;
  40. import SYSTEM;
  41. const
  42. AxiBaseAddr0 = 07F000000H; (* base address of first AXI interface *)
  43. ChanOffset = 256*4; (* channel offset in bytes *)
  44. InpValidOffset = 0; (* offset for accessing input valid flag of a channel *)
  45. OutReadyOffset = 4; (* offset for accessing output ready flag of a channel *)
  46. DataOffset = 8; (* offset for accessing channel data *)
  47. Chan0Addr = AxiBaseAddr0 + 0*ChanOffset;
  48. Chan1Addr = AxiBaseAddr0 + 1*ChanOffset;
  49. GpoPortAddr = Chan0Addr;
  50. var
  51. gpoValue: longint;
  52. begin
  53. gpoValue := 256;
  54. SYSTEM.PUT(GpoPortAddr,gpoValue);
  55. end TestGpo.