VHDL Tips

はじめに

時々必要になるが、その時には多分忘れているであろう知識を書き残しておく。

end xxxx の後のラベルは省略可

[VHDL 2019]
xxxx は entity, architecture, process 等。begin より前にラベル名があるのだから end の後は不要と考えるのは自然なこと。実際,それで GHDL v0.6.0, VHDL-LS はエラーを出さない。

符号付きの値のビット・スライスの符号

[VHDL 2019]
EDA Playground: VHDL_signedness
要点だけ抜き出すと:

architecture behavioral of test_bench is
  signal a_0: signed(7 downto 0) := "01111111";
  signal a_1: signed(7 downto 0) := "11111111";
  signal b_0: signed(6 downto 0) := a_0(7 downto 1);
  signal b_1: signed(6 downto 0) := a_1(7 downto 1);
  signal c_0: signed(6 downto 0) := a_0(6 downto 0);
  signal c_1: signed(6 downto 0) := a_1(6 downto 0);
begin
  process begin
  	report "a_0: "&integer'image(to_integer(a_0)) severity note;
    report "a_1: "&integer'image(to_integer(a_1)) severity note;
    report "b_0: "&integer'image(to_integer(b_0)) severity note;
    report "b_1: "&integer'image(to_integer(b_1)) severity note;
    report "c_0: "&integer'image(to_integer(c_0)) severity note;
    report "c_1: "&integer'image(to_integer(c_1)) severity note;
    wait;
  end process;
end architecture behavioral;

出力:

testbench.vhd:17:8:@0ms:(report note): a_0: 127
testbench.vhd:18:5:@0ms:(report note): a_1: -1
testbench.vhd:19:5:@0ms:(report note): b_0: 63
testbench.vhd:20:5:@0ms:(report note): b_1: -1
testbench.vhd:21:5:@0ms:(report note): c_0: -1
testbench.vhd:22:5:@0ms:(report note): c_1: -1

投稿者: motchy

DSP and FPGA engineer working on measuring instrument.

コメントを残す