📄 add_accumulator.vhd
字号:
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 18:27:45 05/30/07
-- Design Name:
-- Module Name: add_accumulator - Behavioral
-- Project Name:
-- Target Device:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity add_accumulator is
port (
RESET :IN std_logic;
B :IN std_logic_VECTOR(11 downto 0);
Q :OUT std_logic_VECTOR(21 downto 0);
CLK :IN std_logic;
SCLR :IN std_logic
);
end add_accumulator;
architecture Behavioral of add_accumulator is
signal q_buf: std_logic_VECTOR(21 downto 0):=(others=>'0');
begin
process(CLK,RESET,SCLR,B)
variable cnt:integer:=0;
begin
if RESET='0' THEN
q_buf<=(others=>'0');
Q<=(others=>'0');
elsif rising_edge(CLK) THEN
if SCLR='1' THEN
q_buf<=(others=>'0');
Q<=(others=>'0');
else
q_buf<=q_buf+B;
end if;
Q<=q_buf;
end if;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -