OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [branches/] [mkfiles_rev1/] [rtl/] [Testbench/] [TB_vdu8.vhd] - Blame information for rev 113

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 dilbert57
-- ------------------------------------------------------------
2
--  TB_vdu8 Test Bench
3
-- ------------------------------------------------------------
4
-- (c) Bertrand Cuzeau
5
--
6
 
7
Library IEEE;
8
  use IEEE.std_logic_1164.all;
9
  use IEEE.numeric_std.all;
10
  use STD.textio.all;
11
  use IEEE.std_logic_textio.all;
12
 
13
Entity TB_vdu8 is end;
14
 
15
Architecture TEST of tb_vdu8 is
16
 
17
  subtype Byte is std_logic_vector (7 downto 0);
18
 
19
  signal vdu_clk_in   : std_logic := '0';
20
  signal cpu_clk_out  : std_logic;
21
  signal vdu_rst      : std_logic;
22
  signal vdu_cs       : std_logic := '0';
23
  signal vdu_rw       : std_logic := '1';
24
  signal vdu_addr     : std_logic_vector(2 downto 0) := "000";
25
  signal vdu_data_in  : std_logic_vector(7 downto 0);
26
  signal vdu_data_out : std_logic_vector(7 downto 0);
27
  signal vga_red_o   : std_logic;
28
  signal vga_green_o : std_logic;
29
  signal vga_blue_o  : std_logic;
30
  signal vga_hsync_o : std_logic;
31
  signal vga_vsync_o : std_logic;
32
 
33
  constant Msg       : string := "Hello! X";
34
  signal done        : boolean;
35
  constant Period : time := 10 ns;
36
 
37
begin
38
 
39
vdu_clk_in <= '0' when Done else not vdu_clk_in after Period / 2;
40
vdu_rst <= '1', '0' after 16 * Period;
41
 
42
vdu: Entity work.vdu8
43
  port map (
44
    vdu_clk_in    => vdu_clk_in   ,
45
    cpu_clk_out   => cpu_clk_out  ,
46
    vdu_rst       => vdu_rst      ,
47
    vdu_cs        => vdu_cs       ,
48
    vdu_rw        => vdu_rw       ,
49
    vdu_addr      => vdu_addr     ,
50
    vdu_data_in   => vdu_data_in  ,
51
    vdu_data_out  => vdu_data_out ,
52
    vga_red_o     => vga_red_o    ,
53
    vga_green_o   => vga_green_o  ,
54
    vga_blue_o    => vga_blue_o   ,
55
    vga_hsync_o   => vga_hsync_o  ,
56
    vga_vsync_o   => vga_vsync_o
57
    );
58
 
59
process
60
  procedure Writebyte (b : Byte; Addr : integer) is
61
  begin
62
    wait for 500 ns;
63
    vdu_cs <= '1';
64
    vdu_data_in <= b;
65
    vdu_addr <= std_logic_vector(to_unsigned(Addr,3));
66
    wait for 100 ns;
67
    vdu_rw <= '0';
68
    wait for 200 ns;
69
    vdu_rw <= '1';
70
    vdu_cs <= '0';
71
  end procedure;
72
 
73
  procedure WriteChar (c : character; color:byte; x:integer; y:integer; offs:integer) is
74
  begin
75
    WriteByte(std_logic_vector(to_unsigned(character'pos(c),8)),0);
76
    WriteByte(color,1);
77
    WriteByte(std_logic_vector(to_unsigned(x,8)),2);
78
    WriteByte(std_logic_vector(to_unsigned(y,8)),3);
79
    WriteByte(std_logic_vector(to_unsigned(offs,8)),4);
80
  end procedure;
81
 
82
begin
83
  vdu_data_in <= x"00";
84
  wait until vga_hsync_o='0';
85
  for i in Msg'range loop
86
    WriteChar(Msg(i), x"17",i,i,1);  -- ?? bgB bgG bgR Blink?? fgB fgG fgR  <<< TBV
87
  end loop;
88
  wait until vga_vsync_o='0';
89
  wait for 5 ms;
90
  report "End of Simulation";
91
  done <= true;
92
  wait;
93
end process;
94
 
95
end architecture TEST;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.