Constant project_init::includes::RECO_MAIN [] [src]

pub const RECO_MAIN: &'static str = "package main\n\nimport (\n\t// Import the entire framework\n\t_ \"sdaccel\"\n\n\taximemory \"axi/memory\"\n\taxiprotocol \"axi/protocol\"\n)\n\n// The kernel (this goes on the FPGA).\nfunc Top(\n\t// The first set of arguments to this function can be any number\n\t// of Go primitive types and can be provided via `SetArg` on the host.\n\n\t// For this example, we have 3 arguments: two operands to add\n\t// together and an address to memory (the uint32s) on the FPGA to\n\t// store the output (the uintptr)\n\ta uint32,\n\tb uint32,\n\taddr uintptr,\n\n\t// The second set of arguments will be the ports for interacting with memory\n\tmemReadAddr chan<- axiprotocol.Addr,\n\tmemReadData <-chan axiprotocol.ReadData,\n\n\tmemWriteAddr chan<- axiprotocol.Addr,\n\tmemWriteData chan<- axiprotocol.WriteData,\n\tmemWriteResp <-chan axiprotocol.WriteResp) {\n\n\t// Since we\'re not reading anything from memory, disable those reads\n\tgo axiprotocol.ReadDisable(memReadAddr, memReadData)\n\n\t// Calculate the value\n\tval := a + b\n\n\t// Write it back to the pointer the host requests\n\taximemory.WriteUInt32(\n\t\tmemWriteAddr, memWriteData, memWriteResp, false, addr, val)\n}\n"