Section 13.6. Future Refinements


13.6. Future Refinements

There are a number of ways that this application could be improved for even higher levels of performance, above and beyond simply adding more worker processes and modifying the configuration function accordingly.

For example, depending on the nature of the target hardware platform, it might be desirable to eliminate the need for shared memory, which must (as currently written) hold the entire image. If the goal is instead to stream the pixel results in a sorted manner, scan line by scan line, an alternative means of worker process synchronization would be required. One possible approach would be to implement a token-passing mechanism, in which each worker processor passes a message (using a signal) to subsequent processes, such that each process streams its output (representing a single scan line) to the controlling process only after the preceding process has completed its operations. This optimization and other potential means of acceleration are left for you, the reader, to contemplate.

Figure 13-7. Configuration function, Mandelbrot image generator.
 #define BUFSIZE 2         /* buffer size for FIFO in hardware */ void config_mand(void *arg) {   int i;   co_memory img;   co_process test_proc, ctrl_proc;   co_process genline_proc[NUM_UNITS];   co_stream req[NUM_UNITS],ack[NUM_UNITS];   co_stream config_stream;   co_signal done;   img = co_memory_create("img","ext0",YSIZE*XSIZE*3);   config_stream = co_stream_create("config_stream", UINT_TYPE(32),                                    BUFSIZE);   for (i=0; i < NUM_UNITS; i++)      req[i] = co_stream_create("req",UINT_TYPE(32),BUFSIZE);   for (i=0; i < NUM_UNITS; i++)      ack[i] = co_stream_create("ack",UINT_TYPE(8),BUFSIZE);   done=co_signal_create("done");   test_proc=co_process_create("test_proc",(co_function)test_mandelbrot,                               3, config_stream,img,done);   for (i=0; i<NUM_UNITS; i++)       genline_proc[i] = co_process_create("gen",(co_function)genline,                                           3, img,req[i],ack[i]);   ctrl_proc = co_process_create("ctrl_proc",(co_function)ctrl,                                   8, config_stream,done,                                   req[0],req[1],req[2],                                   ack[0],ack[1],ack[2]);   co_process_config(ctrl_proc,co_loc,"PE0");   for (i=0; i < NUM_UNITS; i++)     co_process_config(genline_proc[i],co_loc,"PE0"); } co_architecture co_initialize() {   return(co_architecture_create("mand","generic_vhdl",config_mand, NULL)); } 



    Practical FPGA Programming in C
    Practical FPGA Programming in C
    ISBN: 0131543180
    EAN: 2147483647
    Year: 2005
    Pages: 208

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net