Skip to content

Commit

Permalink
Almost finish tp7
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasVanPhan committed Apr 12, 2018
1 parent d10ebab commit c889090
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 17 deletions.
Empty file added tme7/Makefile
Empty file.
3 changes: 2 additions & 1 deletion tme7/soft/config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef _CONFIG_H
#define _CONFIG_H

#define NB_PROCS 2
#define NB_PROCS 1
#define NB_MAXTASKS 1
#define NO_HARD_CC 1

#endif
61 changes: 47 additions & 14 deletions tme7/soft/main_dma.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,51 @@

#include "stdio.h"

#define NPIXEL 128
#define NLINE 128
#define NPIXEL 256
#define NLINE 256

///////////////////////////////////////////////////////////////////////////////
// main function
///////////////////////////////////////////////////////////////////////////////
__attribute__ ((constructor)) void main()
{
unsigned char BUF[NPIXEL*NLINE];
unsigned char BUF1[NPIXEL*NLINE];
unsigned char BUF2[NPIXEL*NLINE];
unsigned char *BUF;
unsigned int line;
unsigned int pixel;
unsigned int step;

for(step = 1 ; step < 6 ; step++)
/* --------------------------- PROLOGUE --------------------------------- */
step = 1;
BUF = BUF1;

for(pixel = 0 ; pixel < NPIXEL ; pixel++)
{
for(line = 0 ; line < NLINE ; line++)
{
if( ( (pixel>>step & 0x1) && !(line>>step & 0x1)) ||
(!(pixel>>step & 0x1) && (line>>step & 0x1)) ) BUF[NPIXEL*line + pixel] = 0xFF;
else BUF[NPIXEL*line + pixel] = 0x0;
}
}
tty_printf(" - build %d OK at cycle %d\n", step, proctime());

// Pipeline synchronization

/* --------------------------- LOOP ------------------------------------- */
for(step = 2 ; step < 6 ; step++)
{
tty_printf("\n*** damier %d ***\n\n",step);
/* ---- DISPLAY PICTURE (STEP - 1) ---- */
BUF = ((step & 1) == 0) ? BUF1 : BUF2;
if(fb_write(0, BUF, NLINE*NPIXEL) != 0)
{
tty_printf("\n!!! error in fb_syn_write syscall !!!\n");
exit();
}

/* ---- BUILD PICTURE (STEP) ---- */
BUF = (BUF == BUF1) ? BUF2 : BUF1;
for(pixel = 0 ; pixel < NPIXEL ; pixel++)
{
for(line = 0 ; line < NLINE ; line++)
Expand All @@ -27,18 +55,23 @@ __attribute__ ((constructor)) void main()
else BUF[NPIXEL*line + pixel] = 0x0;
}
}
tty_printf(" - build %d OK at cycle %d\n", step, proctime());

tty_printf(" - build OK at cycle %d\n", proctime());

if(fb_sync_write(0, BUF, NLINE*NPIXEL) != 0)
{
tty_printf("\n!!! error in fb_syn_write syscall !!!\n");
exit();
}

tty_printf(" - display OK at cycle %d\n", proctime());
/* ---- Pipeline synchronisation ---- */
fb_completed();
tty_printf(" - display %d OK at cycle %d\n", step, proctime());

}
/* --------------------------- EPILOGUE --------------------------------- */
BUF = ((step & 1) == 0) ? BUF1 : BUF2;
if(fb_write(0, BUF, NLINE*NPIXEL) != 0)
{
tty_printf("\n!!! error in fb_syn_write syscall !!!\n");
exit();
}
fb_completed();
tty_printf(" - display %d OK at cycle %d\n", step, proctime());

tty_printf("\nFin du programme au cycle = %d\n\n", proctime());
exit();
} // end main
Expand Down
43 changes: 43 additions & 0 deletions tme7/soft/main_dma.c.bak2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

#include "stdio.h"

#define NPIXEL 256
#define NLINE 256

///////////////////////////////////////////////////////////////////////////////
// main function
///////////////////////////////////////////////////////////////////////////////
__attribute__ ((constructor)) void main()
{
unsigned char BUF[NPIXEL*NLINE];
unsigned int line;
unsigned int pixel;
unsigned int step;

/* --------------------------- LOOP ------------------------------------- */
for(step = 1 ; step < 6 ; step++)
{
/* ---- BUILD PICTURE (STEP) ---- */
for(pixel = 0 ; pixel < NPIXEL ; pixel++)
{
for(line = 0 ; line < NLINE ; line++)
{
if( ( (pixel>>step & 0x1) && !(line>>step & 0x1)) ||
(!(pixel>>step & 0x1) && (line>>step & 0x1)) ) BUF[NPIXEL*line + pixel] = 0xFF;
else BUF[NPIXEL*line + pixel] = 0x0;
}
}
tty_printf(" - build %d OK at cycle %d\n", step, proctime());

/* ---- DISPLAY PICTURE (STEP - 1) ---- */
if(fb_sync_write(0, BUF, NLINE*NPIXEL) != 0)
{
tty_printf("\n!!! error in fb_syn_write syscall !!!\n");
exit();
}
tty_printf(" - display %d OK at cycle %d\n", step, proctime());
}
tty_printf("\nFin du programme au cycle = %d\n\n", proctime());
exit();
} // end main

4 changes: 2 additions & 2 deletions tme7/tp7_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
#define RAM_LATENCY 0 // ram latency
#define ICACHE_WAYS 4 // instruction cache number of ways
#define ICACHE_SETS 32 // instruction cache number of sets
#define ICACHE_WORDS 8 // instruction cache number of words per line
#define ICACHE_WORDS 4 // instruction cache number of words per line
#define DCACHE_WAYS 4 // data cache number of ways
#define DCACHE_SETS 32 // data cache number of sets
#define DCACHE_WORDS 8 // data cache number of words per line
#define DCACHE_WORDS 4 // data cache number of words per line
#define WBUF_DEPTH 8 // cache write buffer depth
#define SNOOP false // cache snoop activation
#define DMA_BURST 16 // number of words in a DMA burst
Expand Down

0 comments on commit c889090

Please sign in to comment.