• 大小: 20.77MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-14
  • 语言: 其他
  • 标签: THADA  DE2-115  fpga  verilog  

资源简介

This is a report on the implementation of an oscilloscope on the DE2-35 FPGA development kit for the Mini-Project as part of the ELEC5563 course. The basic functionality of an oscilloscope i.e. sample an analogue signal and display it were the minimum requirements. Additional features were suggested for additional marks. Apart from the minimum requirements, more than half of the additional functionalities have been successfully implemented along with other features which weren’t directly indicated.

资源截图

代码片段和文件信息

close all

[filename pathname] = uigetfile( ...
{‘*.BMP;*.GIF;*.JPG;*.PNG;*.TIF‘‘All Graphics files (*.BMP*.GIF*.JPG*.PNG*.TIF)‘;
   ‘*.BMP‘  ‘Windows Bitmap files (*.BMP)‘; ...
   ‘*.GIF‘‘Graphics Interchange Format files (*.GIF)‘; ...
   ‘*.JPG;*.JPEG‘‘Joint Photographic Experts Group files (*.JPG*.JPEG)‘; ...
   ‘*.PNG‘‘Portable Network Graphics files (*.PNG)‘; ...
   ‘*.TIF;*.TIFF‘‘Tagged Image File Format files (*.TIF*.TIFF)‘; ...
   ‘*.*‘  ‘All Files (*.*)‘} ...
   ‘Pick a file‘);

image = imread([pathname filename]);

bits = 4;

A=image;

%Plot Image and RGB Separations
figure
subplot(221)
imagesc(A)

subplot(222)
red = A;
red(::2) = ones(size(red(::2)));
red(::3) = ones(size(red(::3)));
imagesc(red)

subplot(223)
green = A;
green(::1) = ones(size(green(::1)));
green(::3) = ones(size(green(::3)));
imagesc(green)

subplot(224)
blue = A;
blue(::1) = ones(size(blue(::1)));
blue(::2) = ones(size(blue(::2)));
imagesc(blue)

drawnow

dimension = size(image);
pic_width=dimension(2);
pic_height=dimension(1);

image = double(A);
A=zeros(120160);

[XY] = meshgrid(1:pic_width1:pic_height);
[XIYI] = meshgrid(1:(pic_width/160.1):pic_width1:(pic_height/120.1):pic_height);
A(::1) = interp2(XYimage(::1)XIYI‘spline‘);
A(::2) = interp2(XYimage(::2)XIYI‘spline‘);
A(::3) = interp2(XYimage(::3)XIYI‘spline‘);

A = uint8(A);

i=0;
dimension = size(A);
pic_width=dimension(2);
pic_height=dimension(1);

depth = pic_width*pic_height;
sampled = A;

fid = fopen(‘display.mif‘ ‘wt‘);
fprintf(fid ‘-- MatLab generated Memory Initialization File (.mif)\n‘);
fprintf(fid ‘\n‘);
fprintf(fid ‘WIDTH=%i;\n‘bits*3);
fprintf(fid ‘DEPTH=%i;\n\n‘depth);
fprintf(fid ‘ADDRESS_RADIX=UNS;\n‘);
fprintf(fid ‘DATA_RADIX=UNS;\n‘);
fprintf(fid ‘\n‘);
fprintf(fid ‘CONTENT BEGIN\n‘);

for h=1:pic_height
    for w=1:pic_width
        
        %Calculate HEX values for MIF data
        R=dec2bin(A(hw1)8);
        G=dec2bin(A(hw2)8);
        B=dec2bin(A(hw3)8);
        MIF = bin2dec([ ‘0‘ B(1:bits) G(1:bits) R(1:bits) ]);
        sampled(hw1) = bin2dec( [ ‘0‘ R(1:bits) char(ones(18-bits)+48)]);
        sampled(hw2) = bin2dec( [ ‘0‘ G(1:bits) char(ones(18-bits)+48)]);
        sampled(hw3) = bin2dec( [ ‘0‘ B(1:bits) char(ones(18-bits)+48)]);
        fprintf(fid ‘\t%i\t:\t%i;\n‘iMIF);
        i=i+1;
        
    end
end
fprintf(fid ‘END;\n‘);
fclose(fid);

%Plot Image and RGB Separations
figure
subplot(221)
imagesc(sampled)

subplot(222)
red = sampled;
red(::2) = ones(size(red(::2)));
red(::3) = ones(size(red(::3)));
imagesc(red)

subplot(223)
green = sampled;
green(::1) = ones(size(green(::1)));
green(::3) = ones(size(green(::3)));
imagesc(green)

subplot(224)
blue = sampled;
blue(::1) = ones(size(blue(::1)));
blue(::2) = ones(size(blue(::2)));

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-05-14 22:32  LCM_VGA\
     文件        2484  2014-03-09 22:35  LCM_VGA\att.v
     文件        2008  2014-03-09 22:35  LCM_VGA\attenuation.bsf
     文件        1225  2014-03-09 22:35  LCM_VGA\attenuation.inc
     文件         350  2014-03-09 22:35  LCM_VGA\Chain4.cdf
     文件        2390  2014-03-09 22:35  LCM_VGA\compressor.bsf
     文件        1822  2016-04-07 23:01  LCM_VGA\compressor.v
     文件         367  2014-03-09 22:35  LCM_VGA\compressor.v.bak
     目录           0  2016-05-14 23:30  LCM_VGA\db\
     文件        3686  2014-03-09 22:35  LCM_VGA\db\altsyncram_0q14.tdf
     文件        3721  2014-03-09 22:35  LCM_VGA\db\altsyncram_1q14.tdf
     文件        3686  2014-03-09 22:35  LCM_VGA\db\altsyncram_2q14.tdf
     文件        6409  2016-04-08 23:42  LCM_VGA\db\altsyncram_2r14.tdf
     文件       12617  2016-04-01 13:25  LCM_VGA\db\altsyncram_40d1.tdf
     文件       12617  2016-05-05 21:49  LCM_VGA\db\altsyncram_50d1.tdf
     文件       92585  2016-03-07 19:19  LCM_VGA\db\altsyncram_5ca2.tdf
     文件       45077  2014-03-09 22:35  LCM_VGA\db\altsyncram_8eq1.tdf
     文件        3707  2014-03-09 22:35  LCM_VGA\db\altsyncram_8q14.tdf
     文件       12535  2014-03-09 22:35  LCM_VGA\db\altsyncram_8rc1.tdf
     文件       85677  2014-03-09 22:35  LCM_VGA\db\altsyncram_9eq1.tdf
     文件       45077  2014-03-09 22:35  LCM_VGA\db\altsyncram_aeq1.tdf
     文件        3699  2014-03-09 22:35  LCM_VGA\db\altsyncram_aq14.tdf
     文件       20341  2016-04-08 22:39  LCM_VGA\db\altsyncram_au14.tdf
     文件       15008  2016-05-05 23:19  LCM_VGA\db\altsyncram_bu14.tdf
     文件        3667  2014-03-09 22:35  LCM_VGA\db\altsyncram_cs14.tdf
     文件       21415  2016-04-08 23:45  LCM_VGA\db\altsyncram_cu14.tdf
     文件       17210  2016-04-01 13:25  LCM_VGA\db\altsyncram_ddo1.tdf
     文件        3719  2014-03-09 22:35  LCM_VGA\db\altsyncram_eq14.tdf
     文件       17292  2016-04-23 17:48  LCM_VGA\db\altsyncram_fjo1.tdf
     文件       69437  2014-03-09 22:35  LCM_VGA\db\altsyncram_geq1.tdf
     文件       13880  2016-04-07 21:21  LCM_VGA\db\altsyncram_gr14.tdf
............此处省略4653个文件信息

评论

共有 条评论