VHDL文字解释
几天前我开始学习 VHDL 初学者课程。
我有一个代码(下面),我试图了解它显示的电路类型以及不同步骤的功能。 我已经在互联网上浏览了一段时间,但无法真正理解它的作用?所以我想现在有人可以给我一些解释吗? :.-)
我不确定,但我认为它是一种带有缓冲区的“加法器”?缓冲区使用 2 位(Cs-1 到 0)工作,但是我不知道 Cs 是什么意思……事实上,这段代码中有很多东西我不明白。
如果有人花一些时间帮助我用文字理解代码,我将非常感激。
entity asc is
generic (CS : integer := 8)
port (k, ars, srs, e, u: in std_logic;
r: buffer std_logic_vector(Cs-1 downto 0));
end asc;
architecture arch of asc is
begin
p1: process (ars, k) begin
if ars = ‘1’ then
r <= (others => ‘0’);
elsif (k’event and k=’1’) then
if srs=’1’ then
r <= (others) => ‘0’);
elsif (e = ‘1’ and u = ‘1’) then
r <= r + 1;
elsif (e = ‘1’ and u = ‘0’) then
r <= r - 1;
else
r <= r;
end if;
end if;
end process;
end arch;
I started with VHDL course for beginners a few days ago.
I’ve got a code (under) and I’m trying to understand what kind of circuit it shows and how the different steps are functioning.
I’ve been looking around fore a while now in the Internet but can’t really understand what it does? So I thought someone who now this might give me some explanations’? :.-)
I`m not sure but I think it is a type of an “adder” with a buffer? And the buffer is working with 2 bits (Cs-1 downto 0) however I don’t know what Cs means….in fact there is a lot of things in this code I don’t understand.
I would really appreciate if some one would take some time to help me understand the code in words.
entity asc is
generic (CS : integer := 8)
port (k, ars, srs, e, u: in std_logic;
r: buffer std_logic_vector(Cs-1 downto 0));
end asc;
architecture arch of asc is
begin
p1: process (ars, k) begin
if ars = ‘1’ then
r <= (others => ‘0’);
elsif (k’event and k=’1’) then
if srs=’1’ then
r <= (others) => ‘0’);
elsif (e = ‘1’ and u = ‘1’) then
r <= r + 1;
elsif (e = ‘1’ and u = ‘0’) then
r <= r - 1;
else
r <= r;
end if;
end if;
end process;
end arch;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我用 Sigasi HDT 重命名了实体的输入和输出(并更正了一些语法错误),这应该会带来更多好处明确你的实体确实如此。我做了以下重命名:
如果 enable 被断言并且 count_up 为 true,结果 (r) 将增加在时钟上升沿。如果 count_up 为 false,且在时钟上升沿 enable 为 true,则结果将递减。
使用此代码片段时要小心:
I renamed the inputs and outputs of your entity with Sigasi HDT (and corrected some syntax errors) which should make a lot more clear your entity does. I did following renames:
If enable is asserted and count_up is true, the result (r) will be incremented on a rising clock edge. If count_up is false, the result will be decremented if enable is true on a rising clock edge.
Be careful when using this code snippet: