Code · 1 file
Sample VHDL File
VHDL hardware description: a generic counter with synchronous reset. Every language sample implements the same small program so you can compare them side by side.
VHDL · 920 B
Sample VHDL file
An idiomatic VHDL example — the same customer program (or, for hardware languages, a small counter design) we offer in every language.
CC0 · free for any use · Verified by an independent tool · Report a problem
-- Sample VHDL — samplefiles.com
-- An up-counter with synchronous reset, enable and an overflow flag.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity counter is
generic (WIDTH : positive := 8);
port (
clk : in std_logic;
rst : in std_logic;
en : in std_logic;
count : out unsigned(WIDTH - 1 downto 0);
overflow : out std_logic
);
end entity counter;
architecture rtl of counter is
constant MAX_VALUE : unsigned(WIDTH - 1 downto 0) := (others => '1');
signal value : unsigned(WIDTH - 1 downto 0) := (others => '0');
begin
process (clk)
begin
if rising_edge(clk) then
if rst = '1' thenFile details
Download from the command line
curl -L -o counter.vhd https://files.samplefiles.com/code/vhd/counter.vhdwget https://files.samplefiles.com/code/vhd/counter.vhdhttps://files.samplefiles.com/code/vhd/counter.vhdprintf '%s %s\n' c86eebac5f76dbc355f1c4b9a71e194786c11cecf0b46d4d79a5c80e69d72393 counter.vhd | shasum -a 256 -cOr check the download in your browser with the checksum calculator.