Aide-mémoire¶
En-tête standard¶
Pour un banc :
Entité et architecture¶
entity block_name is
generic (
G_WIDTH : positive := 8
);
port (
clk_i : in std_logic;
reset_i : in std_logic;
data_i : in unsigned(G_WIDTH - 1 downto 0);
data_o : out unsigned(G_WIDTH - 1 downto 0)
);
end entity;
architecture rtl of block_name is
signal data_q : unsigned(G_WIDTH - 1 downto 0);
begin
-- Région concurrente
end architecture;
Instanciation¶
u_name : entity work.block_name(rtl)
generic map (
G_WIDTH => 16
)
port map (
clk_i => clk_i,
reset_i => reset_i,
data_i => input_s,
data_o => output_s
);
Processus combinatoire¶
process(all)
begin
y_o <= DEFAULT_VALUE;
if condition_i = '1' then
y_o <= selected_i;
end if;
end process;
Processus cadencé¶
process(clk_i)
begin
if rising_edge(clk_i) then
if reset_i = '1' then
q_o <= RESET_VALUE;
elsif enable_i = '1' then
q_o <= d_i;
end if;
end if;
end process;
Multiplexeur¶
Conversions¶
| Depuis | Vers | Expression |
|---|---|---|
| integer | unsigned | to_unsigned(value, width) |
| integer | signed | to_signed(value, width) |
| unsigned | integer | to_integer(value) |
| signed | integer | to_integer(value) |
| std_logic_vector | unsigned | unsigned(value) |
| std_logic_vector | signed | signed(value) |
| unsigned/signed | std_logic_vector | std_logic_vector(value) |
| redimensionner | même type numérique | resize(value, new_width) |
Attributs de tableaux¶
signal data : std_logic_vector(7 downto 0);
data'length -- 8
data'high -- 7
data'low -- 0
data'range -- 7 downto 0
data'reverse_range -- 0 to 7
Déclaration FSM¶
Horloge et reset de banc¶
constant CLOCK_PERIOD : time := 10 ns;
signal clk_s : std_logic := '0';
signal reset_s : std_logic := '1';
clk_s <= not clk_s after CLOCK_PERIOD / 2;
stimulus : process
begin
wait until rising_edge(clk_s);
wait until rising_edge(clk_s);
reset_s <= '0';
wait until rising_edge(clk_s);
-- Tests
finish;
end process;
Assertion¶
assert actual = expected
report "Mismatch: expected=" & integer'image(expected) &
" actual=" & integer'image(actual)
severity failure;
Timeout¶
watchdog : process
begin
wait for 1 ms;
assert false report "TIMEOUT" severity failure;
end process;
XSim¶
xvhdl.bat -2008 src\design.vhd
xvhdl.bat -2008 tb\tb_design.vhd
xelab.bat work.tb_design -s tb_design_sim
xsim.bat tb_design_sim -R
Horloge Basys 3 dans le XDC¶
set_property PACKAGE_PIN W5 [get_ports clk_i]
set_property IOSTANDARD LVCMOS33 [get_ports clk_i]
create_clock -period 10.000 -name sys_clk [get_ports clk_i]
Rapports Vivado¶
Avant programmation¶
- Régression réussie.
- Bon sommet et bon composant.
- Broches et I/O standards corrects.
- Horloge contrainte.
- Aucun latch ou pilote multiple involontaire.
- DRC réussi.
- Setup et hold respectés.
- CDC comprises.