博文
数字时钟vhdl代码(2008-04-22 20:59:00)
摘要:
同上一篇一样,也是做过的实验 ,这里只发一个顶层文件给大家,提供一个整体的思路,因为整个设计包括比较多的vhdl文件,所以不便于上传,
----------the clock top design file
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity clock is
port(clk_20m : in std_logic;----20M晶振输入
rst : in std_logic;----复位按钮(总清0)
clk_dis : in std_logic;---扫描频率
--clk_con : in std_logic;---总控制台计数频率
alarm_set : in std_logic;
choose_mode : in std_logic;---先择12小时制(0)还是24小时制(1)
set_min : in std_logic;--设置分的单脉冲发生器
set_hou : in std_logic;---设置小时的单脉冲发生器
display7 : out std_logic_vector(6 downto 0);--7个数码管的公共的7端
select6 : out std_logic_vector(5 downto 0);--6个片选端
alarm : out std_logic);---闹钟输出
end entity clock;
--------------......
矩阵键盘的VHDL(2008-04-22 20:56:00)
摘要:这也是做实验时编的代码,由于做完将近一年了,当时也没有注意到要防抖,所以这个程序没有进行防抖,需要进行防抖 的朋友可以加锁存器进行锁存。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity matrix_key is
port(clk : in std_logic;
display : out std_logic_vector(13 downto 0);
row : buffer std_logic_vector(3 downto 0);----行线
line : in std_logic_vector(3 downto 0));--列线
end entity matrix_key;
------------------------------------------------------
architecture behave of matrix_key is
component division is
generic (data : integer:=10);
port(clk_in : in std_logic;
clk_out : out std_logic);
end component;
signal read_data : std_logic_vector(3 downto 0);
signal scan_data : std_logic_vector(1 downto 0);
signal clk_temp : std_logic;
begin
U1: division port map(clk,clk_temp);
P1: process(clk_temp)
variable temp : std_logic_vector(1 downto 0);
begin
if ......
flash闪存知识(2008-04-19 19:57:00)
摘要:
用的是21control的niosII开发板,经过3天的苦苦学习,终于跑上一个系统了,其中很多错误都在网上找资料具体地一个一个弄明白了,其中有几个关键文档是必读的,一个是software handbook,还有一个是hardware handbook,千万不要害怕英语难读,目前大多关于这方面的教材大多都是翻译这些东西。把其中的所有过程弄得还算是比较清楚的,感觉很爽。虽然altera这种开发环境隐藏了很多具体实现的细节,(特别是硬 件部分),但我本人认为细细地去研究一下还是很有必要的,因为有不研究清楚你就无法解释和理解一些错误怎么出来的。这种以IP核为主要硬件开发的思路很好,只要你开发出一个,似乎有点一劳永逸的感觉。我得继续努力,原计划在两个月内一定要把uclinux移植上去的,不过想回来,这东西不能急,得弄添清楚细节,一步一个脚印地走下去。继续努力,给自己打打气。
今天想把sdram与flash弄清楚,他们的时序正如网上一些朋友说的,有点像天书时序,但也得看看,对于flash的资料,基本没有中文的,看起来虽然不算太费劲,但是有些专业词汇还是不能理解透彻,下面这位朋友这些东西写得还 不错,大致了解下flash到底是个什么东西,对我们还是有好处的
另外这也有一文章,知识较好,给出地址
http://blog.21ic.com/user1/2437/archives/2007/44237.html
NOR和NAND是现在市场上两种主要的非易失闪存技术。Intel于1988年首先开发出NOR flash技术,彻底改变了原先由EPROM和EEPROM一统天下的局面。紧接着,1989年,东芝公司发表了NAND flash结构,强调降低每比特的成本,更高的性能,并且象磁盘一样可以通过接口轻松升级。但是经过了十多年之后,仍然有相当多的硬件工程师分不清NOR和NAND闪存。
相“flash存储器”经常可以与相“NOR存储器”互换使用。许多业内人士也搞不清楚NAND闪存技术相对于NOR技术的优越之处,因为大多数情况下闪存只是用来存储少......
NiosII 中导入工程提示:invalid project descripti(2008-04-16 14:13:00)
摘要:Eclipse中导入工程提示:invalid project description[转载]
2006年11月07日 星期二 08:58
Today, when I imported an existing project into eclipse's workspace, I got the following error:
Invalid project description.
D:/eclipse/workspace/report and D:/eclipse/workspace overlap
In the beginning, my project was located in D:/report instead of the workspace directory of eclipse, and its name was test. It worked well then. After googling on the internet, I found the root cause of the problem.
There are two kinds of places where projects can be located:
1) In the "default" location. This means that the project directory is a direct child directory of the workspace directory (aka the platform instance location), and the project directory name matches the project name.
2) Outside the default location, in a directory that is neither a parent or child of the platform instance location. In this case the directory name does not need to match the project name.
As you can see, my project belongs to the......
NIOS II 常见问题总结(2008-04-12 12:04:00)
摘要:
一开始在开发板实验就遇到问题了,找到了一些比较好的解答,贴出来工共享,不知是哪位网友总结出来的,在此只能说一声谢谢!
1. 怎样在TCL脚本分配管脚 source <pin_assign>.tcl 有点问题:
# source stratix_pin_assign.tcl
couldn't read file "stratix_pin_assign.tcl": no such file or directory
答: From the Tools menu select Tcl Scripts, and then from the project folder choose the setup script for your particular development board, and click Run.
2.D:\TEST\nios_sst60下载时出现错误:
Error: Can't configure device. Expected JTAG ID code 0x020010DD for device 1, but found JTAG ID code 0x020B40DD.
答:SOPC所选器件和开发板上的不一致。
3.在NOIS II中Bulid例程hello_world都出现了错误,错误提示为:
gdrive/c/altera/kits/nios2/components/altera_nios2/HAL/src/alt_busy_sleep.c:68: error: parse error before '/' token等错误全部由alt_busy_sleep.c引起,都是关于括号不匹配的问题,而alt_busy_sleep.c是IDE中的一个默认程序。这个错误同样出现在D:\TEST\DE2Project\software\nios2 ,培训用的一个简单实验。
答:找到system.h文件,里面有个关于系统时钟频率的设置项,应该是没有赋值,你手动赋值。比如你用50MHZ的时钟,就设成50000000
如果总是出现上述问题,可能和软件有关系,建议重新安装软件。注意quartus和NIOS安装版本一定要相同,不能混装。<......
SDRAM的结构、时序与性能(2008-04-10 20:44:00)
摘要:由于nios ii应用系统中涉及到sdram应用,将其详细内容贴到如下:
http://www.pcdog.com/a/29/10/f230509.html
http://www.pcdog.com/a/29/10/f230510.html
这是网上分析得比较透的一个说明......
各电平标准参考与比较(2008-04-10 16:57:00)
摘要:下面总结一下各电平标准。和新手以及有需要的人共享一下^_^.
现在常用的电平标准有TTL、CMOS、LVTTL、LVCMOS、ECL、PECL、LVPECL、RS232、RS485等,还有一些速度比较高的 LVDS、GTL、PGTL、CML、HSTL、SSTL等。下面简单介绍一下各自的供电电源、电平标准以及使用注意事项。
TTL:Transistor-Transistor Logic 三极管结构。
Vcc:5V;VOH>=2.4V;VOL<=0.5V;VIH>=2V;VIL<=0.8V。
因为2.4V与5V之间还有很大空闲,对改善噪声容限并没什么好处,又会白白增大系统功耗,还会影响速度。所以后来就把一部分“砍”掉了。也就是后面的LVTTL。
LVTTL又分3.3V、2.5V以及更低电压的LVTTL(Low Voltage TTL)。
3.3V LVTTL:
Vcc:3.3V;VOH>=2.4V;VOL<=0.4V;VIH>=2V;VIL<=0.8V。
2.5V LVTTL:
Vcc:2.5V;VOH>=2.0V;VOL<=0.2V;VIH>=1.7V;VIL<=0.7V。
更低的LVTTL不常用就先不讲了。多用在处理器等高速芯片,使用时查看芯片手册就OK了。
TTL使用注意:TTL电平一般过冲都会比较严重,可能在始端串22欧或33欧电阻; TTL电平输入脚悬空时是内部认为是高电平。要下拉的话应用1k以下电阻下拉。TTL输出不能驱动CMOS输入。
CMOS:Complementary Metal Oxide Semiconductor PMOS+NMOS。
Vcc:5V;VOH>=4.45V;VOL<=0.5V;VIH>=3.5V;VIL<=1.5V。
相对TTL有了更大的噪声容限,输入阻抗远大于TTL输入阻抗。对应3.3V LVTTL,出现了LVCMOS,可以与3......
Altera FPGA开发软件安装指南(2008-04-10 15:57:00)
摘要:个人接触EDA东西将近有半年了,以前主要是在老师的课堂上学习一点东西,自认为这种技术的发展给人的思想带来的更大的自由,最近两周开始在研究Nios II,看了两周的理论,买的21Control工作室的开发板也到了,前段时间对整个环境的建立,(对我而言,主要是NIOS IDE 与DSPBUILDER的安装),其中有些license不太好用,在网上苦寻的时候发现了这位朋友的这个文档,很好,基本上写得很全面,因些在这贴出来供刚开始学习的朋友入门.
关于这些软件的下载大家可以上21control工作室,也可以去欣欣工作室,当然也可以去申请网络版,由于一些图片传不上来,这里的文件只是一些文字,关于license大家可以去网上找,确实有困难的可以联系我,^^不过我这只有6.0版本的,我的邮箱是yanys113@163.com
Altera FPGA开发软件安装指南
安装顺序请参照下面软件的介绍顺序。本文的顺序是参照Altera Complete Design Suite中的软件的安装顺序介绍的。
一、 MATLAB(要求R14或以后版本)
1. 注意:请将MATLAB安装在英文路径下。如安装路径,或项目路径包含中文,则运行DSP Builder时可能会出现错误。解决方法是在项目中将路径改为英文的路径。
2. 如果不使用DSP Builder,则MATLAB不需要安装。
二、 Quartus II 6. 0(6. 1)
3. 执行install.exe,在Quartus II Install CD页面(图1),执行第一项Install Quartus II and Related Software,安装Quartus II。
图1 Quartus II Install CD页面
4. 软件安装过程同其他软件没有区别,只是在第二步时有一个Choose the Software窗口(图2),选择要安装的软件组件。
如果直接使用安装程序setup.exe,将不会出现这个选择。
......
链表中建立,删除,插入操作(2007-12-20 16:35:00)
摘要:
/*学生结构体包括number,sex,age,score,*p几个成员*/
#include<stdio.h>
#include<malloc.h>
#define NULL 0
#define LENGTH sizeof(struct student)
struct student
{
int number;
char sex;/*M(male) or F(famal)*/
int age;
double score;
struct student *next;
};
void main()
{
struct student *del(struct student *del,int key);/*删除链表中key这个结点值*/
void output(struct student *P);/*输出一个链表的函数*/
struct student *insert(struct student *head,struct student *in);/*插入一个结点放在此链表的最后面*/
struct student *creat(int m);/*创建一个新的链表*/
void start();
struct student *new_list=NULL;
struct student plug;/*插入的结点*/
char select;/*输入界面的先择*/
int b=0;/*删除链表中的结点的number*/
int s=0; /*创建链表时的结点数*/
printf("**学生结构体包括number,sex(M or F),age,score,*p几个成员**\n");
printf("***输入时请注意:number age 请输入整数***\n");
printf("***score输入整数或小数\t sex输入M或F***\n");
字符串的排序(2007-12-17 15:44:00)
摘要:#include<stdio.h>
#include<string.h>
#define LENGTH 20
#define N 5
void main()
{
void sort(char *name[],int n);
void print(char *name[],int n);
int i;
char string[N][LENGTH];
char *p;
char *temp[N];
for(i=0;i<N;i++)
{
printf("Please input the %d compare string:\n",i+1);
p=*(string+i);/*二维数组对应一行的首地址传给一个指针*/
gets(p);
temp[i]=p;
}
sort(temp,N);
print(temp,N);
}
void sort(char *name[],int n)/*从小到大排序的函数*/
{
char *temp;
int i,j,k;
for(i=0;i<n-1;i++)
{
k=i;
for(j=i+1;j<n;j++)
{
if(strcmp(name[k],name[j])>0)
k=j;
if(k!=i)/*只有上一个if成立才执行*/
{
temp=name[i];
name[i]=name[k];
name[k]=temp;
}
}
}
}
void print(char ......