1 / 13

CSCE 313: Embedded Systems Multiprocessor Systems

CSCE 313: Embedded Systems Multiprocessor Systems. Instructor: Jason D. Bakos. Multiprocessor Systems. SOPC Builder allows you to add multiple CPUs to your design The CPUs can share memories and other system components

telma
Télécharger la présentation

CSCE 313: Embedded Systems Multiprocessor Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCE 313: Embedded SystemsMultiprocessor Systems Instructor: Jason D. Bakos

  2. Multiprocessor Systems • SOPC Builder allows you to add multiple CPUs to your design • The CPUs can share memories and other system components • SOPC Builder also offers hardware components to allow multiple CPUs to synchronize and communicate • Having multiple CPUs allows you to speed up the system by taking advantage of parallelism

  3. System Design new components JTAG UART0 JTAG UART1 CPU 1 CPU 0 Avalon bus Avalon-MM tristate bridge mailbox 0 SDRAM interface SRAM interface Video DMA Onchipmem 0 KEYS Onchipmem 1 mailbox 1 CFI Flash Interface Remove timer_0 Set the data cache size of both to be no larger than 4KB

  4. Adding Processors for cpu1-> reset vector 0x400000 exception vector 0x400020 for cpu1, cpuid=1

  5. Adding Processors • In Eclipse, you need a project and a BSP for EACH processor • Each processor must be launched separately • Both processors should have the same code • Use symbolic link to link the hello_world.c file: cd lights/software/lab4_cpu1 rmhello_world.c ln –s ../lab4_cpu0/hello_world.chello_world.c • Processor self identification (in code): // get CPU ID cpuid=__builtin_rdctl(5);

  6. Processor Synchronization • Make any processor reaching the barrier wait until all processors reach that point • Useful when parallelized computations occur in “stages” processor 0 processor 1 barrier (hold) barrier

  7. Dividing up the Work • How do you divide the work amongst multiple independent CPUs? • In the context of lab 3... CPU 0 CPU 1 read image from Flash read image from Flash Data-level parallelism: barrier Apply transformation to even rows and send output pixels to SRAM Apply transformation to odd rowsand send output pixels to SRAM barrier

  8. Mailboxes • Mailboxes use small on-chip memory to allow processors to communicate • Add onchip RAM memory, 32 bits wide, 512 entries deep

  9. Mailboxes • Add a mailbox for each processor, connected to this on-chip memory

  10. Mailboxes • Software interface:

  11. Implementing Barriers • Use a “mailbox”, a hardware FIFO queue where processors can atomically read and write 32-bit messages • Algorithm, assuming N processors: • Create N mailboxes, associate each processor with a mailbox • When processor A reaches a barrier, send one message each into all other mailboxes, except mailbox A • Try to read N-1 messages from mailbox A

  12. Implementing Barriers with Mailboxes #include <altera_avalon_mailbox.h> #define NUM_CPUS 2 void barrier() { alt_u32 msg; alt_mailbox_dev*mb[NUM_CPUS]; char mb_name[80]; intcpu=__builtin_rdctl(5),i; // open all mailboxes for (i=0;i<NUM_CPUS;i++) { sprintf(mb_name,"/dev/mailbox_%d",i); mb[i]=altera_avalon_mailbox_open(mb_name); } // post one message to all other mailboxes for (i=0;i<NUM_CPUS;i++) { if (i!=cpu) altera_avalon_mailbox_post(mb[i],0); } // receive one message from all other CPUs for (i=0;i<NUM_CPUS-1;i++) altera_avalon_mailbox_pend(mb[cpu]);; // close mailboxes for (i=0;i<NUM_CPUS;i++) altera_avalon_mailbox_close(mb[i]); }

  13. Debugging • Can debug both processors simultaneously • Change in Run Configurations, then debug

More Related