我正在VHDL书中尝试一个简单的案例问题。从源代码中可以理解,它根据输入范围设置输出值。但是,当我使用GHDL运行测试平台时,我无法观察到我的输入x
。
这是因为x
是character
类型吗?我应该询问GHDL问题页面(https://github.com/ghdl/ghdl/issues)吗?
源代码(q4_case.vhd):
entity q4_case is
port (
x : in character; -- input
character_class : out integer); -- output
end entity q4_case;
architecture behav of q4_case is
begin -- architecture behav
-- purpose: set output depending on range of input
-- type : combinational
-- inputs : x
-- outputs: character_class
process (x) is
begin -- process
case x is
when 'A' to 'z' => character_class <= 1;
when '0' to '9' => character_class <= 2;
when nul to usp | del => character_class <= 4;
when others => character_class <= 3;
end case;
end process;
end architecture behav;
测试台(q4_case_tb.vhd):
library ieee;
use ieee.std_logic_1164.all;
-------------------------------------------------------------------------------
entity q4_case_tb is
end entity q4_case_tb;
-------------------------------------------------------------------------------
architecture q4_case_tb of q4_case_tb is
-- component ports
signal x : character;
signal character_class : integer;
-- clock
signal Clk : std_logic := '1';
begin -- architecture q4_case_tb
-- component instantiation
DUT : entity work.q4_case
port map (
x => x,
character_class => character_class);
-- clock generation
Clk <= not Clk after 10 ns;
-- waveform generation
WaveGen_Proc : process
begin
-- insert signal assignments here
x <= 'b';
wait until Clk = '1';
wait until Clk = '0';
x <= 'F';
wait until Clk = '1';
wait until Clk = '0';
x <= dc3;
wait until Clk = '1';
wait until Clk = '0';
x <= usp;
wait until Clk = '1';
wait until Clk = '0';
x <= del;
wait until Clk = '1';
wait until Clk = '0';
x <= '0';
wait until Clk = '1';
wait until Clk = '0';
x <= '5';
wait until Clk = '1';
wait until Clk = '0';
x <= '9';
wait until Clk = '1';
wait until Clk = '0';
x <= '=';
wait until Clk = '1';
wait until Clk = '0';
x <= 'Ü';
wait until Clk = '1';
wait until Clk = '0';
report "End of simulation" severity failure;
end process WaveGen_Proc;
end architecture q4_case_tb;
-------------------------------------------------------------------------------
configuration q4_case_tb_q4_case_tb_cfg of q4_case_tb is
for q4_case_tb
end for;
end q4_case_tb_q4_case_tb_cfg;
-------------------------------------------------------------------------------
编译并运行命令:
ghdl -a q4_case.vhd
ghdl -a q4_case_tb.vhd
ghdl -r q4_case_tb --vcd=q4_case.vcd
版本信息:
ghdl -v
GHDL 0.35 (tarball) [Dunoon edition]
Compiled with GNAT Version: GPL 2017 (20170515-63)
mcode code generator
Written by Tristan Gingold.
Copyright (C) 2003 - 2015 Tristan Gingold.
GHDL is free software, covered by the GNU General Public License. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
下面给出VCD输出文件的开头。正如您所看到的,x
未得到处理,我无法通过使用GTKWave查看x
。
VCD的一部分:
$date
Thu Feb 08 09:19:40 2018
$end
$version
GHDL v0
$end
$timescale
1 fs
$end
$comment x is not handled $end
$var integer 32 ! character_class $end
$var reg 1 " clk $end
$scope module dut $end
$comment x is not handled $end
$var integer 32 # character_class $end
$upscope $end
$enddefinitions $end
#0
b1 !
1"
b1 #
#10000000
...
...
答案 0 :(得分:1)
我认为你的问题不在于GHDL本身,而是因为它使用Verilog VCD format来记录波形。那个维基百科页面说
标准的四值VCD格式与IEEE标准1364-1995在1996年的Verilog硬件描述语言一起定义。
这四个值分别为0,1,X和Z.
答案 1 :(得分:1)
我的错是我没有正确检查GHDL文档。正如https://ghdl.readthedocs.io/en/latest/using/Simulation.html(马修指出)所写,VCD格式仅支持来自./bin/hiveserver2
Cannot find hadoop installation: $HADOOP_HOME or $HADOOP_PREFIX must be set or hadoop must be in the path
的{{1}}和bit
。用VCD文件观察bit_vector
类型的信号是不可能的。
正如Brain建议从VCD切换到GHW格式解决了这个问题。在这种情况下,GKTWave显示GHW文件没有任何问题。