VHDL之concurrent之generate
GENERATE
It is another concurrent statement (along with operators and WHEN). It is equivalent to the sequential statement LOOP in the sense that it
allows a section of code to be repeated a number of times, thus creating several instances of the same assignments.
1) FOR / GENERATE: notice that GENERATE must be labeled.
label: FOR identifier IN range GENERATE
(concurrent assignments)
END GENERATE;
2) IF/GENERATE
An irregular form is also available, which uses IF/GENERATE (with an IF equivalent; recall that originally IF is a sequential statement). Here ELSE is not allowed.
label1: FOR identifier IN range GENERATE
...
label2: IF condition GENERATE
(concurrent assignments)
END GENERATE;
...
END GENERATE;
Example 1
SIGNAL x: BIT_VECTOR ( DOWNTO );
SIGNAL y: BIT_VECTOR ( DOWNTO );
SIGNAL z: BIT_VECTOR ( DOWNTO );
...
G1: FOR i IN x'RANGE GENERATE
z(i) <= x(i) AND y(i+);
END GENERATE;
Example 2 Vector Shifter
The output vector must be a shifted version of the input vector, with twice its width and an amount of shift specified by another input.
For example, if the input bus has width 4, and the present value is ‘‘1111’’, then the output should be one of the lines of the following
matrix (the original vector is underscored):
row(0): 0 0 0 0 1 1 1 1
row(1): 0 0 0 1 1 1 1 0
row(2): 0 0 1 1 1 1 0 0
row(3): 0 1 1 1 1 0 0 0
row(4): 1 1 1 1 0 0 0 0
------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
------------------------------------------------
ENTITY shifter IS
PORT ( inp: IN STD_LOGIC_VECTOR ( DOWNTO );
sel: IN INTEGER RANGE TO ;
outp: OUT STD_LOGIC_VECTOR ( DOWNTO ));
END shifter;
------------------------------------------------
ARCHITECTURE shifter OF shifter IS
SUBTYPE vector IS STD_LOGIC_VECTOR ( DOWNTO );
TYPE matrix IS ARRAY ( DOWNTO ) OF vector;
SIGNAL row: matrix;
BEGIN
row() <= "" & inp;
G1: FOR i IN TO GENERATE
row(i) <= row(i-)( DOWNTO ) & '';
END GENERATE;
outp <= row(sel);
END shifter;
------------------------------------------------
VHDL之concurrent之generate的更多相关文章
- VHDL之concurrent之when
WHEN (simple and selected) It is one of the fundamental concurrent statements (along with operators ...
- VHDL之concurrent之block
1 Simple BLOCK The simple block represents only a way of partitioning the code. It allows concurrent ...
- VHDL之concurrent之operators
Using operators Operators can be used to implement any combinational circuit. However, as will becom ...
- Concurrent.Thread.js
(function(){ if ( !this.Data || (typeof this.Data != 'object' && typeof this.Data != 'functi ...
- how to forget about delta cycles for RTL design
A delta cycle is a VHDL construct used to makeVHDL, a concurrent language, executable on asequential ...
- Oracle E-Business Suite Maintenance Guide Release 12.2(Patching Procedures)
更多内容参考: http://docs.oracle.com/cd/E51111_01/current/acrobat/122ebsmt.zip Preparing for Patching For ...
- How to measure IOPS for VMware
http://blog.synology.com/blog/?p=2225 Executive SummaryThis article, intended towards IT Professiona ...
- Generate PDF in Sourcing through concurrent request,在EBS java并发中调用指定am的方法
package oracle.apps.pon.printing.cp; import java.io.InputStream; import java.io.FileOutputStream; im ...
- VHDL基础1
Description Structure 一个可综合的VHDL描述中一般由3部分组成:LIBRARY declarations.ENTITY.ARCHITECTURE Library(库)用来设计重 ...
随机推荐
- file.seek()/tell()-笔记
---------------------------------------------------------------------------------------------------- ...
- BZOJ 3732 Network 【模板】kruskal重构树
[题解] 首先,我们可以发现,A到B的所有路径中,最长边的最小值一定在最小生成树上.我们用Kruskal最小生成树时,假设有两个点集U,V,若加入一条边w(u,v)使U,V联通,那么w就是U中每个点到 ...
- Tkinter图形界面设计(GUI)
[因为这是我第一个接触的GUI图形界面python库,现在也不用了,所以大多数内容都来自之前花 钱买的一些快速入门的内容,可以当作简单的知识点查询使用] 在此声明:内容来自微信公众号GitChat,付 ...
- Excel 2010/2013/2016在鼠标右键新建xls或xlsx文件后,打开报错“无法打开文件”“文件格式或文件扩展名无效”
近段时间,陆续有两个同事先后出现同样的问题(在Excel多个版本都可能出现),问题描述: 当用鼠标右键在任意文件夹或电脑桌面“新建”→“ Microsoft Excel 工作表”,再用鼠标双击打开这个 ...
- MongoDB整库备份与还原以及单个collection备份、恢复
备份前的检查> show dbsMyDB 0.0625GBadmin (empty)bruce 0.0625GBlocal (empty)test 0.0625GB> use MyDBsw ...
- 联赛前集训日记Day3
考试 竟然出了道莫比乌斯函数的应用?? 简直没法玩 刷题 莫比乌斯函数摆在面前,咋能很快改完啊 生活 GGGGGGGGGGG 自己浪过头了,开回家一周 这车翻得猝不及防,然而自己作的,自己受,只是给别 ...
- 联赛前集训日记Day1
考试 炸的凄惨 T1 显然要高精搞一下,然而我的$DFS$竟然比我的$O(n^{2})$递推快 T2 欧拉路径的题,很不可做的样子,就没敢费时间打 T3 $DFS$枚举可过,然而我太蠢 GG 刷题 改 ...
- 洛谷 P1851 好朋友
题目背景 小可可和所有其他同学的手腕上都戴有一个射频识别序列号码牌,这样老师就可以方便的计算出他们的人数.很多同学都有一个“好朋友” .如果 A 的序列号的约数之和恰好等于B 的序列号,那么 A的好朋 ...
- hdu 4081 最小生成树变形
/*关于最小生成树的等效边,就是讲两个相同的集合连接在一起 先建立一个任意最小生成树,这条边分开的两个子树的节点最大的一个和为A,sum为最小生成树的权值和,B为sum-当前边的权值 不断枚举最小生成 ...
- [Cypress] Create True end-to-end Tests with Cypress (Smoke test)
Integration tests let us keep our tests fast and reliable. They also allow us to test scenarios that ...