Shaos wrote: 20 Mar 2025 23:32
Так что придётся тестбенчи писать на том же самом VHDL...
Обновил репу (и архив) - теперь в
ternary.vhd есть функция
tostr, которая переводит трит в строку, что можно использовать для формирования отчётов при тестировании тестбенча - обновлённый пример
test_mem.vhd:
Code: Select all
use work.ternary.all;
entity test_mem is
end test_mem;
architecture Behavioral of test_mem is
signal ts : FakeTrit := N;
signal tn : FakeTrit := N;
signal tp : FakeTrit := P;
signal tq : FakeTrit;
begin
mem1: ternary_mem port map( T_S => ts, T_N => tn, T_P => tp, T_Q => tq);
TEST : process is
begin
ts <= O;
wait for 10 ns;
report "N->O [NP] value should still be N => " & tostr(tq) severity note;
ts <= P;
wait for 10 ns;
report "O->P [NP] value should switch to P => " & tostr(tq) severity note;
ts <= O;
wait for 10 ns;
report "P->O [NP] value should still be P => " & tostr(tq) severity note;
ts <= N;
wait for 10 ns;
report "O->N [NP] value should switch to N => " & tostr(tq) severity note;
ts <= O;
wait for 10 ns;
report "N->O [NP] value should still be N => " & tostr(tq) severity note;
tn <= P;
tp <= N;
wait for 10 ns;
report "O->O [PN] value should still be N => " & tostr(tq) severity note;
ts <= N;
wait for 10 ns;
report "O->N [PN] value should switch to P => " & tostr(tq) severity note;
ts <= O;
wait for 10 ns;
report "N->O [PN] value should still be P => " & tostr(tq) severity note;
ts <= P;
wait for 10 ns;
report "O->P [PN] value should switch to N => " & tostr(tq) severity note;
ts <= O;
wait for 10 ns;
report "P->O [PN] value should still be N => " & tostr(tq) severity note;
tn <= O;
tp <= O;
wait for 10 ns;
report "O->O [OO] value should still be N => " & tostr(tq) severity note;
ts <= P;
wait for 10 ns;
report "O->P [OO] value should switch to O => " & tostr(tq) severity note;
ts <= O;
wait for 10 ns;
report "P->O [OO] value should still be O => " & tostr(tq) severity note;
ts <= N;
wait for 10 ns;
report "O->N [OO] value should still be O => " & tostr(tq) severity note;
ts <= O;
wait for 10 ns;
report "N->O [OO] value should still be O => " & tostr(tq) severity note;
wait;
end process;
end Behavioral;
Скрипт компиляции и запуска через GHDL:
Code: Select all
ghdl -a ternary.vhd
ghdl -a test_mem.vhd
ghdl -e test_mem
ghdl -r test_mem --stop-time=200ns
И вот что оно печатает при прогоне:
Code: Select all
test_mem.vhd:21:4:@10ns:(report note): N->O [NP] value should still be N => N
test_mem.vhd:24:4:@20ns:(report note): O->P [NP] value should switch to P => P
test_mem.vhd:27:4:@30ns:(report note): P->O [NP] value should still be P => P
test_mem.vhd:30:4:@40ns:(report note): O->N [NP] value should switch to N => N
test_mem.vhd:33:4:@50ns:(report note): N->O [NP] value should still be N => N
test_mem.vhd:37:4:@60ns:(report note): O->O [PN] value should still be N => N
test_mem.vhd:40:4:@70ns:(report note): O->N [PN] value should switch to P => P
test_mem.vhd:43:4:@80ns:(report note): N->O [PN] value should still be P => P
test_mem.vhd:46:4:@90ns:(report note): O->P [PN] value should switch to N => N
test_mem.vhd:49:4:@100ns:(report note): P->O [PN] value should still be N => N
test_mem.vhd:53:4:@110ns:(report note): O->O [OO] value should still be N => N
test_mem.vhd:56:4:@120ns:(report note): O->P [OO] value should switch to O => O
test_mem.vhd:59:4:@130ns:(report note): P->O [OO] value should still be O => O
test_mem.vhd:62:4:@140ns:(report note): O->N [OO] value should still be O => O
test_mem.vhd:65:4:@150ns:(report note): N->O [OO] value should still be O => O
You do not have the required permissions to view the files attached to this post.