۰۷-آبان-۱۳۸۸, ۰۳:۲۳:۳۹
صفحهها: 1 2
۰۷-آبان-۱۳۸۸, ۰۳:۵۷:۵۱
سلام
نرم افزار رو دانلود کردم ، خیلی جالبه :
دارای بخش شبیه ساز هست
دارای help قوی هست ، توی راهنماش یه قسمت به نام Impulse C Application Programming Interface (API) داره که در اون کلیه دستورات زبان c رو توضیح داده ( دستورات مخصوص fpga )
و این هم یکی از مثال هاش :
نرم افزار رو دانلود کردم ، خیلی جالبه :
دارای بخش شبیه ساز هست
دارای help قوی هست ، توی راهنماش یه قسمت به نام Impulse C Application Programming Interface (API) داره که در اون کلیه دستورات زبان c رو توضیح داده ( دستورات مخصوص fpga )
و این هم یکی از مثال هاش :
کد:
// ////////////////////////////////////////////////////////////////
// 3X3 kernel image fliter example. This test bench reads grayscale
// images from a BMP file. This means that the data is only 8-bit,
// although we are testing a 16-bit fliter. This test bench should
// probably read/write PICT files instead.
//
// Copyright(c) 2003-2006 Impulse Accelerated Technologies, Inc.
//
// img_sw.c: includes the software test bench processes and
// main() function.
//
#ifdef WIN32
#include <windows.h>
#include <sys/types.h>
#include <sys/stat.h>
#else // ! WIN32
#include <sys/stat.h>
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "co.h"
#include "co_math.h"
#include "cosim_log.h"
#include "img.h"
#include "bmp.h"
BITMAPFILEHEADER header; /* Bitmap header */
BITMAPINFO info; /* Bitmap information */
unsigned int infosize;
extern co_architecture co_initialize(void *);
void producer(co_stream pixels_raw, co_signal header_ready)
{
unsigned int i, i1, j;
cosim_logwindow log = cosim_logwindow_create("producer");
// Read bitmap from a BMP format file
const char * FileName = INPUT_FILE; // See .h
FILE * infile;
unsigned char *pBitMap;
unsigned int PixelCount;
unsigned int ByteCount;
co_uint16 pixelValue;
infile = fopen(FileName, "rb");
if ( infile == NULL ) {
fprintf(stderr, "Error opening BMP file %s\n", FileName);
exit(-1);
}
// Read the file header and info sections...
if (fread(&header, sizeof(BITMAPFILEHEADER), 1, infile) < 1)
{
fclose(infile);
fprintf(stderr, "Error reading BMP header for %s\n", FileName);
exit(-1);
}
if (header.bfType != 0x4d42) /* Check for BM magic number */
{
fclose(infile);
fprintf(stderr, "File %s does not appear to be a BMP file.\n", FileName);
exit(-1);
}
infosize = header.bfOffBits - sizeof(BITMAPFILEHEADER);
if (fread(&info, 1, infosize, infile) < infosize)
{
fclose(infile);
fprintf(stderr, "Coudn't read the bitmap info for %s.\n", FileName);
exit(-1);
}
if (info.bmiHeader.biWidth != WIDTH ||
info.bmiHeader.biHeight != HEIGHT)
{
fclose(infile);
fprintf(stderr, "Bitmap must be %dW X %dH.\n", WIDTH, HEIGHT);
exit(-1);
}
// Tell the consumer that we've finished reading the header...
co_signal_post(header_ready,1);
// Now read the pixel data from the file...
PixelCount = WIDTH * HEIGHT;
ByteCount = header.bfSize - header.bfOffBits;
pBitMap = (unsigned char *) malloc(sizeof(unsigned char) * ByteCount);
if (fread(pBitMap, 1, ByteCount, infile) < ByteCount)
{
fclose(infile);
fprintf(stderr, "Coudn't read the pixel data for %s.\n", FileName);
exit(-1);
}
// Send the pixel data as 16-bit values to the Impulse C hardware process
co_stream_open(pixels_raw, O_WRONLY, UINT_TYPE(16));
cosim_logwindow_write(log, "Sending BMP pixels...\n");
// First send in an extra scan line (duplicate the first line)...
for (i=0, j=0; j < WIDTH; j++) {
pixelValue = (pBitMap[i++]);
co_stream_write(pixels_raw, &pixelValue, sizeof(pixelValue));
}
// Now send in all the pixels for the image
printf("Sending BMP pixels...\n");
for (i=0; i < ByteCount;) {
pixelValue = (pBitMap[i++]);
co_stream_write(pixels_raw, &pixelValue, sizeof(pixelValue));
}
// Now send in two more extra scan lines (duplicating the last line)...
for (i1=0; i1<2;i1++) {
i -= WIDTH;
for (j=0; j < WIDTH; j++) {
pixelValue = (pBitMap[i++]);
co_stream_write(pixels_raw, &pixelValue, sizeof(pixelValue));
}
}
cosim_logwindow_write(log, "Finished writing BMP pixels\n");
printf("Finished writing BMP pixels\n");
co_stream_close(pixels_raw);
fclose(infile);
}
void consumer(co_stream pixels_filtered, co_signal header_ready)
{
co_uint16 pixelValue;
co_int32 signaldata;
unsigned int pixelCount = 0;
const char * FileName = OUTPUT_FILE; // See img.h
FILE * outfile;
cosim_logwindow log = cosim_logwindow_create("consumer");
co_signal_wait(header_ready, &signaldata);
outfile = fopen(FileName, "wb");
if ( outfile == NULL ) {
fprintf(stderr, "Error opening BMP file %s for writing\n", FileName);
exit(-1);
}
// Read the file header and info sections...
if (fwrite(&header, 1, sizeof(BITMAPFILEHEADER), outfile) < 1)
{
fclose(outfile);
fprintf(stderr, "Error writing BMP header for %s\n", FileName);
exit(-1);
}
if (fwrite(&info, 1, infosize, outfile) < 1)
{
fclose(outfile);
fprintf(stderr, "Error writing BMP info for %s\n", FileName);
exit(-1);
}
co_stream_open(pixels_filtered, O_RDONLY, UINT_TYPE(16));
cosim_logwindow_write(log, "Consumer reading data...\n");
printf("Consumer reading data...\n");
while ( co_stream_read(pixels_filtered, &pixelValue, sizeof(co_uint16)) == co_err_none ) {
putc(pixelValue, outfile);
pixelCount++;
}
// Fill out any missing pixels
while (pixelCount < WIDTH*HEIGHT) {
putc(0, outfile);
pixelCount++;
}
cosim_logwindow_fwrite(log, "Consumer read %d pixels...\n", pixelCount);
printf("Consumer read %d pixels...\n", pixelCount);
co_stream_close(pixels_filtered);
fclose(outfile);
}
int main(int argc, char *argv[])
{
co_architecture my_arch;
void *param = NULL;
int c;
printf("Impulse C is Copyright 2003-2006 Impulse Accelerated Technologies, Inc.\n");
my_arch = co_initialize(param);
co_execute(my_arch);
printf("\n\nApplication complete. Press the Enter key to continue.\n");
c = getc(stdin);
return(0);
}
۰۹-آبان-۱۳۸۸, ۱۹:۴۰:۴۰
سلام دوستان من میخوام این کتابی که آموزش fpgaبا زبان سی هست رو بخرم
کسی میتونه کمک کنه(اگه بخوام پرینت بگیرم 500*100=50000هزار تومن میشه)
ممنون میشم
کسی میتونه کمک کنه(اگه بخوام پرینت بگیرم 500*100=50000هزار تومن میشه)
ممنون میشم
۱۰-آبان-۱۳۸۸, ۰۰:۰۳:۴۷
كسي با fpga advantage هم كار كرده ؟ محمود شايد به دردت بخوره
۱۰-آبان-۱۳۸۸, ۰۰:۴۷:۵۴
سعید جان بزار با همین معمولی کار کنم پیشرفتش طلبت
۱۴-آبان-۱۳۸۸, ۰۱:۳۰:۲۰
دوستان من امروز از طریق اینترنت کتاب آشنایی با تراشه های FPGA و زبان VHDLرو خریدم
البته نام نویسنده کاوه فارغی هست.
و قرار شد که با زبان vhdlکارکنم .تاچند روز دیگه که فایل وردشو آماده کردم میزغارم تا باهم شروع کنیم
ممنون از همه دوستان که تا اینجا منو یاری کردند.
البته نام نویسنده کاوه فارغی هست.
و قرار شد که با زبان vhdlکارکنم .تاچند روز دیگه که فایل وردشو آماده کردم میزغارم تا باهم شروع کنیم
ممنون از همه دوستان که تا اینجا منو یاری کردند.
۱۸-آبان-۱۳۸۸, ۲۳:۲۷:۵۷
دوستان این برو به نظرتون واسه کار با fpga چه طوره؟
خوبه؟
البته من قیمتش رو ندارم
برد که فایل pdf هست
خوبه؟
البته من قیمتش رو ندارم
برد که فایل pdf هست
صفحهها: 1 2