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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [grlib/] [stdlib/] [stdio_tb.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
------------------------------------------------------------------------------
2
--  This file is a part of the GRLIB VHDL IP LIBRARY
3
--  Copyright (C) 2003, Gaisler Research
4
--
5
--  This program is free software; you can redistribute it and/or modify
6
--  it under the terms of the GNU General Public License as published by
7
--  the Free Software Foundation; either version 2 of the License, or
8
--  (at your option) any later version.
9
--
10
--  This program is distributed in the hope that it will be useful,
11
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
--  GNU General Public License for more details.
14
--
15
--  You should have received a copy of the GNU General Public License
16
--  along with this program; if not, write to the Free Software
17
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
18
--------------------------------------------------------------------------------
19
-- Package:       StdIO
20
-- File:          stdio.vhd
21
-- Author:        Gaisler Research
22
-- Description:   Package for common I/O functions
23
--------------------------------------------------------------------------------
24
 
25
library  Std;
26
use      Std.Standard.all;
27
use      Std.TextIO.all;
28
 
29
library  IEEE;
30
use      IEEE.Std_Logic_1164.all;
31
 
32
library  GRLIB;
33
use      GRLIB.StdIO.all;
34
 
35
entity StdIO_TB is
36
end entity StdIO_TB;
37
 
38
architecture Behavioural of StdIO_TB is
39
begin
40
   process
41
      variable LW:      Line;
42
      variable LR:      Line;
43
 
44
      file     WFile:   Text;
45
      file     RFile:   Text;
46
 
47
      constant SUL:     Std_ULogic        := 'H';
48
      constant SL:      Std_Logic         := 'L';
49
 
50
      constant SULV1:   Std_ULogic_Vector := "1";
51
      constant SULV2:   Std_ULogic_Vector := "10";
52
      constant SULV3:   Std_ULogic_Vector := "011";
53
      constant SULV4:   Std_ULogic_Vector := "0100";
54
      constant SULV5:   Std_ULogic_Vector := "00101";
55
      constant SULV6:   Std_ULogic_Vector := "000110";
56
      constant SULV7:   Std_ULogic_Vector := "0000111";
57
      constant SULV8:   Std_ULogic_Vector := "00001000";
58
      constant SULV9:   Std_ULogic_Vector := "000001001";
59
 
60
      constant SULVA:   Std_ULogic_Vector := "00000001001000110100010101100111";
61
      constant SULVB:   Std_ULogic_Vector := "10001001101010111100110111101111";
62
 
63
      variable SULVC:   Std_ULogic_Vector(0 to 3);
64
      variable SULVD:   Std_ULogic_Vector(0 to 7);
65
      variable SULVE:   Std_ULogic_Vector(0 to 15);
66
      variable SULVF:   Std_ULogic_Vector(0 to 16);
67
 
68
      constant SLVA:    Std_Logic_Vector  := "00000001001000110100010101100111";
69
      constant SLVB:    Std_Logic_Vector  := "10001001101010111100110111101111";
70
      variable SLVC:    Std_Logic_Vector(0 to 7);
71
      variable SLVD:    Std_Logic_Vector(0 to 15);
72
 
73
   begin
74
      Write(LW, SUL);
75
      WriteLine(Output, LW);
76
      Write(LW, SL);
77
      WriteLine(Output, LW);
78
 
79
      HWrite(LW, SULV1);
80
      WriteLine(Output, LW);
81
      HWrite(LW, SULV2);
82
      WriteLine(Output, LW);
83
      HWrite(LW, SULV3);
84
      WriteLine(Output, LW);
85
      HWrite(LW, SULV4);
86
      WriteLine(Output, LW);
87
      HWrite(LW, SULV5);
88
      WriteLine(Output, LW);
89
      HWrite(LW, SULV6);
90
      WriteLine(Output, LW);
91
      HWrite(LW, SULV7);
92
      WriteLine(Output, LW);
93
      HWrite(LW, SULV8);
94
      WriteLine(Output, LW);
95
      HWrite(LW, SULV9);
96
      WriteLine(Output, LW);
97
      HWrite(LW, SULVA);
98
      WriteLine(Output, LW);
99
      HWrite(LW, SULVB);
100
      WriteLine(Output, LW);
101
 
102
      File_Open(WFile, "file.txt", Write_Mode);
103
      HWrite(LW, SULVA);
104
      WriteLine(WFile, LW);
105
      HWrite(LW, SULVB);
106
      WriteLine(WFile, LW);
107
      HWrite(LW, SULVA);
108
      WriteLine(WFile, LW);
109
      HWrite(LW, SULVB);
110
      WriteLine(WFile, LW);
111
      HWrite(LW, SLVA);
112
      WriteLine(WFile, LW);
113
      HWrite(LW, SLVB);
114
      WriteLine(WFile, LW);
115
      File_Close(WFile);
116
 
117
 
118
      File_Open(RFile, "file.txt", Read_Mode);
119
      ReadLine(RFile, LR);
120
      HRead(LR, SULVC);
121
      HWrite(LW, SULVC);
122
      WriteLine(Output, LW);
123
 
124
      ReadLine(RFile, LR);
125
      HRead(LR, SULVD);
126
      HWrite(LW, SULVD);
127
      WriteLine(Output, LW);
128
 
129
      ReadLine(RFile, LR);
130
      HRead(LR, SULVE);
131
      HWrite(LW, SULVE);
132
      WriteLine(Output, LW);
133
 
134
      ReadLine(RFile, LR);
135
      HRead(LR, SULVF);
136
      HWrite(LW, SULVF);
137
      WriteLine(Output, LW);
138
 
139
      ReadLine(RFile, LR);
140
      HRead(LR, SLVC);
141
      HWrite(LW, SLVC);
142
      WriteLine(Output, LW);
143
 
144
      ReadLine(RFile, LR);
145
      HRead(LR, SLVD);
146
      HWrite(LW, SLVD);
147
      WriteLine(Output, LW);
148
 
149
      File_Close(RFile);
150
      wait;
151
   end process;
152
 
153
end architecture Behavioural;

powered by: WebSVN 2.1.0

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