Software Simulation


#1

Is there any way to run a pure software simulation of the FPGA kernel without using the Sdaccel ? This would save us some initial dev time in the early debugging cycles of development.


#2

Hi,

There are a few ways to do this depending on the level of testing you want to do. We typically separate out the bulk of the work from memory access, and use Go’s test framework to test larger pieces. For example, in our crypto library, we test the end to end MD5 process using just plain []byte here https://github.com/ReconfigureIO/crypto/blob/master/md5/md5_test.go

On the other end, sometimes we’ll test the whole kernel locally in the Go runtime using the following:

func main() {
        const n = 200
	ra := make(chan axiprotocol.Addr)
	rd := make(chan axiprotocol.ReadData)

	wa := make(chan axiprotocol.Addr)
	wd := make(chan axiprotocol.WriteData)
	wr := make(chan axiprotocol.WriteResp)

	go func() {
		for {
			a := <-ra
			for i := a.Len; i != 255; i-- {
				rd <- axiprotocol.ReadData{Last: i == 0}
			}
		}
	}()

	go func() {
		for {
			<-wa
			running := true
			for running {
				d := <-wd
				running = !d.Last
			}
			wr <- axiprotocol.WriteResp{}
		}
	}()

	Top(0, 0, uint32(n), ra, rd, wa, wd, wr)

}

This sets up a whole fake memory system that the kernel can interact with. This one was used for a real simple test of a memcopy kernel, but could be extended to read & write from a byte array in order to emulate memory operations, and then verify them.