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

Subversion Repositories mod_sim_exp

[/] [mod_sim_exp/] [tags/] [start_version/] [rtl/] [vhdl/] [core/] [std_logic_textio.vhd] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 JonasDC
----------------------------------------------------------------------------
2
--
3
-- Copyright (c) 1990, 1991, 1992 by Synopsys, Inc.  All rights reserved.
4
--
5
-- This source file may be used and distributed without restriction
6
-- provided that this copyright statement is not removed from the file
7
-- and that any derivative work contains this copyright notice.
8
--
9
--     Package name: STD_LOGIC_TEXTIO
10
--
11
--     Purpose: This package overloads the standard TEXTIO procedures
12
--            READ and WRITE.
13
--
14
--     Author: CRC, TS
15
--
16
----------------------------------------------------------------------------
17
 
18
use STD.textio.all;
19
library IEEE;
20
use IEEE.std_logic_1164.all;
21
 
22
package STD_LOGIC_TEXTIO is
23
--synopsys synthesis_off
24
       -- Read and Write procedures for STD_ULOGIC and STD_ULOGIC_VECTOR
25
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC);
26
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD: out BOOLEAN);
27
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
28
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
29
       procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
30
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
31
       procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
32
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
33
 
34
       -- Read and Write procedures for STD_LOGIC_VECTOR
35
       procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
36
       procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
37
       procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
38
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
39
 
40
       --
41
       -- Read and Write procedures for Hex and Octal values.
42
       -- The values appear in the file as a series of characters
43
       -- between 0-F (Hex), or 0-7 (Octal) respectively.
44
       --
45
 
46
       -- Hex
47
       procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
48
       procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
49
       procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
50
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
51
       procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
52
       procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
53
       procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
54
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
55
 
56
       -- Octal
57
       procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR);
58
       procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD: out BOOLEAN);
59
       procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
60
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
61
       procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR);
62
       procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN);
63
       procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
64
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0);
65
 
66
 
67
--synopsys synthesis_on
68
end STD_LOGIC_TEXTIO;
69
 
70
package body STD_LOGIC_TEXTIO is
71
--synopsys synthesis_off
72
 
73
       -- Type and constant definitions used to map STD_ULOGIC values
74
       -- into/from character values.
75
 
76
       type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', ERROR);
77
       type char_indexed_by_MVL9 is array (STD_ULOGIC) of character;
78
       type MVL9_indexed_by_char is array (character) of STD_ULOGIC;
79
       type MVL9plus_indexed_by_char is array (character) of MVL9plus;
80
 
81
       constant MVL9_to_char: char_indexed_by_MVL9 := "UX01ZWLH-";
82
       constant char_to_MVL9: MVL9_indexed_by_char :=
83
              ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
84
               'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U');
85
       constant char_to_MVL9plus: MVL9plus_indexed_by_char :=
86
              ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z',
87
               'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => ERROR);
88
 
89
 
90
       -- Overloaded procedures.
91
 
92
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC; GOOD:out BOOLEAN) is
93
              variable c: character;
94
              variable readOk: BOOLEAN;
95
       begin
96
              loop                              -- skip white space
97
                     read(l,c,readOk);          -- but also exit on a bad read
98
                     exit when ((readOk = FALSE) or ((c /= ' ') and (c /= CR) and (c /= HT)));
99
              end loop;
100
 
101
              if (readOk = FALSE) then
102
                     good := FALSE;
103
              else
104
                  if (char_to_MVL9plus(c) = ERROR) then
105
                     value := 'U';
106
                     good := FALSE;
107
                   else
108
                     value := char_to_MVL9(c);
109
                     good := TRUE;
110
                  end if;
111
              end if;
112
       end READ;
113
 
114
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR; GOOD:out BOOLEAN) is
115
              variable m:  STD_ULOGIC;
116
              variable c:  character;
117
              variable s:  string(1 to value'length-1);
118
              variable mv: STD_ULOGIC_VECTOR(0 to value'length-1);
119
              constant allU: STD_ULOGIC_VECTOR(0 to value'length-1)
120
                                         := (others => 'U');
121
                variable readOk: BOOLEAN;
122
 
123
       begin
124
              loop                              -- skip white space
125
                     read(l,c,readOk);
126
                     exit when ((readOk = FALSE) or ((c /= ' ') and (c /= CR) and (c /= HT)));
127
              end loop;
128
 
129
-- Bail out if there was a bad read
130
                if (readOk = FALSE) then
131
                        good := FALSE;
132
                     return;
133
                end if;
134
 
135
              if (char_to_MVL9plus(c) = ERROR) then
136
                     value := allU;
137
                     good := FALSE;
138
                     return;
139
              end if;
140
 
141
              read(l, s, readOk);
142
-- Bail out if there was a bad read
143
                if (readOk = FALSE) then
144
                        good := FALSE;
145
                        return;
146
                end if;
147
 
148
              for i in 1 to value'length-1 loop
149
                     if (char_to_MVL9plus(s(i)) = ERROR) then
150
                           value := allU;
151
                           good := FALSE;
152
                            return;
153
                     end if;
154
              end loop;
155
 
156
              mv(0) := char_to_MVL9(c);
157
              for i in 1 to value'length-1 loop
158
                     mv(i) := char_to_MVL9(s(i));
159
              end loop;
160
              value := mv;
161
              good := TRUE;
162
       end READ;
163
 
164
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC) is
165
              variable c: character;
166
       begin
167
              loop                              -- skip white space
168
                     read(l,c);
169
                     exit when ((c /= ' ') and (c /= CR) and (c /= HT));
170
              end loop;
171
 
172
              if (char_to_MVL9plus(c) = ERROR) then
173
                     value := 'U';
174
                     assert FALSE report "READ(STD_ULOGIC) Error: Character '" &
175
                                  c & "' read, expected STD_ULOGIC literal.";
176
              else
177
                     value := char_to_MVL9(c);
178
              end if;
179
       end READ;
180
 
181
       procedure READ(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
182
              variable m: STD_ULOGIC;
183
              variable c: character;
184
              variable s: string(1 to value'length-1);
185
              variable mv: STD_ULOGIC_VECTOR(0 to value'length-1);
186
              constant allU: STD_ULOGIC_VECTOR(0 to value'length-1)
187
                            := (others => 'U');
188
       begin
189
              loop                              -- skip white space
190
                     read(l,c);
191
                     exit when ((c /= ' ') and (c /= CR) and (c /= HT));
192
              end loop;
193
 
194
              if (char_to_MVL9plus(c) = ERROR) then
195
                     value := allU;
196
                     assert FALSE report
197
                           "READ(STD_ULOGIC_VECTOR) Error: Character '" &
198
                                  c & "' read, expected STD_ULOGIC literal.";
199
                     return;
200
              end if;
201
 
202
              read(l, s);
203
              for i in 1 to value'length-1 loop
204
                     if (char_to_MVL9plus(s(i)) = ERROR) then
205
                         value := allU;
206
                         assert FALSE report
207
                           "READ(STD_ULOGIC_VECTOR) Error: Character '" &
208
                                  s(i) & "' read, expected STD_ULOGIC literal.";
209
                         return;
210
                     end if;
211
              end loop;
212
 
213
              mv(0) := char_to_MVL9(c);
214
              for i in 1 to value'length-1 loop
215
                     mv(i) := char_to_MVL9(s(i));
216
              end loop;
217
              value := mv;
218
       end READ;
219
 
220
       procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC;
221
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
222
       begin
223
              write(l, MVL9_to_char(value), justified, field);
224
       end WRITE;
225
 
226
 
227
       procedure WRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
228
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
229
              variable s: string(1 to value'length);
230
              variable m: STD_ULOGIC_VECTOR(1 to value'length) := value;
231
       begin
232
              for i in 1 to value'length loop
233
                     s(i) := MVL9_to_char(m(i));
234
              end loop;
235
              write(l, s, justified, field);
236
       end WRITE;
237
 
238
       -- Read and Write procedures for STD_LOGIC_VECTOR
239
       procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
240
              variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
241
       begin
242
              READ(L, tmp);
243
              VALUE := STD_LOGIC_VECTOR(tmp);
244
       end READ;
245
 
246
       procedure READ(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
247
              variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
248
       begin
249
              READ(L, tmp, GOOD);
250
              VALUE := STD_LOGIC_VECTOR(tmp);
251
       end READ;
252
 
253
       procedure WRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
254
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
255
       begin
256
              WRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
257
       end WRITE;
258
 
259
 
260
       --
261
       -- Hex Read and Write procedures.
262
       --
263
 
264
       --
265
       -- Hex, and Octal Read and Write procedures for BIT_VECTOR
266
       --  (these procedures are not exported, they are only used
267
       --   by the STD_ULOGIC hex/octal reads and writes below.
268
       --
269
       --
270
 
271
       procedure Char2QuadBits(C: Character;
272
                           RESULT: out Bit_Vector(3 downto 0);
273
                           GOOD: out Boolean;
274
                           ISSUE_ERROR: in Boolean) is
275
       begin
276
              case c is
277
                     when '0' => result :=  x"0"; good := TRUE;
278
                     when '1' => result :=  x"1"; good := TRUE;
279
                     when '2' => result :=  x"2"; good := TRUE;
280
                     when '3' => result :=  x"3"; good := TRUE;
281
                     when '4' => result :=  x"4"; good := TRUE;
282
                     when '5' => result :=  x"5"; good := TRUE;
283
                     when '6' => result :=  x"6"; good := TRUE;
284
                     when '7' => result :=  x"7"; good := TRUE;
285
                     when '8' => result :=  x"8"; good := TRUE;
286
                     when '9' => result :=  x"9"; good := TRUE;
287
                     when 'A' => result :=  x"A"; good := TRUE;
288
                     when 'B' => result :=  x"B"; good := TRUE;
289
                     when 'C' => result :=  x"C"; good := TRUE;
290
                     when 'D' => result :=  x"D"; good := TRUE;
291
                     when 'E' => result :=  x"E"; good := TRUE;
292
                     when 'F' => result :=  x"F"; good := TRUE;
293
 
294
                     when 'a' => result :=  x"A"; good := TRUE;
295
                     when 'b' => result :=  x"B"; good := TRUE;
296
                     when 'c' => result :=  x"C"; good := TRUE;
297
                     when 'd' => result :=  x"D"; good := TRUE;
298
                     when 'e' => result :=  x"E"; good := TRUE;
299
                     when 'f' => result :=  x"F"; good := TRUE;
300
                     when others =>
301
                        if ISSUE_ERROR then
302
                              assert FALSE report
303
                                  "HREAD Error: Read a '" & c &
304
                                     "', expected a Hex character (0-F).";
305
                        end if;
306
                        good := FALSE;
307
              end case;
308
       end;
309
 
310
       procedure HREAD(L:inout LINE; VALUE:out BIT_VECTOR)  is
311
              variable ok: boolean;
312
              variable c:  character;
313
              constant ne: integer := value'length/4;
314
              variable bv: bit_vector(0 to value'length-1);
315
              variable s:  string(1 to ne-1);
316
       begin
317
              if value'length mod 4 /= 0 then
318
                     assert FALSE report
319
                           "HREAD Error: Trying to read vector " &
320
                              "with an odd (non multiple of 4) length";
321
                     return;
322
              end if;
323
 
324
              loop                              -- skip white space
325
                     read(l,c);
326
                     exit when ((c /= ' ') and (c /= CR) and (c /= HT));
327
              end loop;
328
 
329
              Char2QuadBits(c, bv(0 to 3), ok, TRUE);
330
              if not ok then
331
                     return;
332
              end if;
333
 
334
              read(L, s, ok);
335
              if not ok then
336
                     assert FALSE
337
                           report "HREAD Error: Failed to read the STRING";
338
                     return;
339
              end if;
340
 
341
              for i in 1 to ne-1 loop
342
                     Char2QuadBits(s(i), bv(4*i to 4*i+3), ok, TRUE);
343
                     if not ok then
344
                           return;
345
                     end if;
346
              end loop;
347
              value := bv;
348
       end HREAD;
349
 
350
       procedure HREAD(L:inout LINE; VALUE:out BIT_VECTOR;GOOD: out BOOLEAN) is
351
              variable ok: boolean;
352
              variable c:  character;
353
              constant ne: integer := value'length/4;
354
              variable bv: bit_vector(0 to value'length-1);
355
              variable s:  string(1 to ne-1);
356
       begin
357
              if value'length mod 4 /= 0 then
358
                     good := FALSE;
359
                     return;
360
              end if;
361
 
362
              loop                              -- skip white space
363
                     read(l,c);
364
                     exit when ((c /= ' ') and (c /= CR) and (c /= HT));
365
              end loop;
366
 
367
              Char2QuadBits(c, bv(0 to 3), ok, FALSE);
368
              if not ok then
369
                     good := FALSE;
370
                     return;
371
              end if;
372
 
373
              read(L, s, ok);
374
              if not ok then
375
                     good := FALSE;
376
                     return;
377
              end if;
378
 
379
              for i in 1 to ne-1 loop
380
                     Char2QuadBits(s(i), bv(4*i to 4*i+3), ok, FALSE);
381
                     if not ok then
382
                           good := FALSE;
383
                           return;
384
                     end if;
385
              end loop;
386
              good := TRUE;
387
              value := bv;
388
       end HREAD;
389
 
390
 
391
       procedure HWRITE(L:inout LINE; VALUE:in BIT_VECTOR;
392
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
393
              variable quad: bit_vector(0 to 3);
394
              constant ne:   integer := value'length/4;
395
              variable bv:   bit_vector(0 to value'length-1) := value;
396
              variable s:    string(1 to ne);
397
       begin
398
              if value'length mod 4 /= 0 then
399
                     assert FALSE report
400
                           "HWRITE Error: Trying to read vector " &
401
                              "with an odd (non multiple of 4) length";
402
                     return;
403
              end if;
404
 
405
              for i in 0 to ne-1 loop
406
                     quad := bv(4*i to 4*i+3);
407
                     case quad is
408
                           when x"0" => s(i+1) := '0';
409
                           when x"1" => s(i+1) := '1';
410
                           when x"2" => s(i+1) := '2';
411
                           when x"3" => s(i+1) := '3';
412
                           when x"4" => s(i+1) := '4';
413
                           when x"5" => s(i+1) := '5';
414
                           when x"6" => s(i+1) := '6';
415
                           when x"7" => s(i+1) := '7';
416
                           when x"8" => s(i+1) := '8';
417
                           when x"9" => s(i+1) := '9';
418
                           when x"A" => s(i+1) := 'A';
419
                           when x"B" => s(i+1) := 'B';
420
                           when x"C" => s(i+1) := 'C';
421
                           when x"D" => s(i+1) := 'D';
422
                           when x"E" => s(i+1) := 'E';
423
                           when x"F" => s(i+1) := 'F';
424
                     end case;
425
              end loop;
426
              write(L, s, JUSTIFIED, FIELD);
427
       end HWRITE;
428
 
429
       procedure Char2TriBits(C: Character;
430
                           RESULT: out bit_vector(2 downto 0);
431
                           GOOD: out Boolean;
432
                           ISSUE_ERROR: in Boolean) is
433
       begin
434
              case c is
435
                     when '0' => result :=  o"0"; good := TRUE;
436
                     when '1' => result :=  o"1"; good := TRUE;
437
                     when '2' => result :=  o"2"; good := TRUE;
438
                     when '3' => result :=  o"3"; good := TRUE;
439
                     when '4' => result :=  o"4"; good := TRUE;
440
                     when '5' => result :=  o"5"; good := TRUE;
441
                     when '6' => result :=  o"6"; good := TRUE;
442
                     when '7' => result :=  o"7"; good := TRUE;
443
                     when others =>
444
                        if ISSUE_ERROR then
445
                              assert FALSE report
446
                                  "OREAD Error: Read a '" & c &
447
                                  "', expected an Octal character (0-7).";
448
                        end if;
449
                        good := FALSE;
450
              end case;
451
       end;
452
 
453
       procedure OREAD(L:inout LINE; VALUE:out BIT_VECTOR)  is
454
              variable c: character;
455
              variable ok: boolean;
456
              constant ne: integer := value'length/3;
457
              variable bv: bit_vector(0 to value'length-1);
458
              variable s: string(1 to ne-1);
459
       begin
460
              if value'length mod 3 /= 0 then
461
                     assert FALSE report
462
                           "OREAD Error: Trying to read vector " &
463
                              "with an odd (non multiple of 3) length";
464
                     return;
465
              end if;
466
 
467
              loop                              -- skip white space
468
                     read(l,c);
469
                     exit when ((c /= ' ') and (c /= CR) and (c /= HT));
470
              end loop;
471
 
472
              Char2TriBits(c, bv(0 to 2), ok, TRUE);
473
              if not ok then
474
                     return;
475
              end if;
476
 
477
              read(L, s, ok);
478
              if not ok then
479
                     assert FALSE
480
                           report "OREAD Error: Failed to read the STRING";
481
                     return;
482
              end if;
483
 
484
              for i in 1 to ne-1 loop
485
                     Char2TriBits(s(i), bv(3*i to 3*i+2), ok, TRUE);
486
                     if not ok then
487
                           return;
488
                     end if;
489
              end loop;
490
              value := bv;
491
       end OREAD;
492
 
493
       procedure OREAD(L:inout LINE; VALUE:out BIT_VECTOR;GOOD: out BOOLEAN) is
494
              variable ok: boolean;
495
              variable c:  character;
496
              constant ne: integer := value'length/3;
497
              variable bv: bit_vector(0 to value'length-1);
498
              variable s:  string(1 to ne-1);
499
       begin
500
              if value'length mod 3 /= 0 then
501
                     good := FALSE;
502
                     return;
503
              end if;
504
 
505
              loop                              -- skip white space
506
                     read(l,c);
507
                     exit when ((c /= ' ') and (c /= CR) and (c /= HT));
508
              end loop;
509
 
510
              Char2TriBits(c, bv(0 to 2), ok, FALSE);
511
              if not ok then
512
                     good := FALSE;
513
                     return;
514
              end if;
515
 
516
              read(L, s, ok);
517
              if not ok then
518
                     good := FALSE;
519
                     return;
520
              end if;
521
 
522
              for i in 1 to ne-1 loop
523
                     Char2TriBits(s(i), bv(3*i to 3*i+2), ok, FALSE);
524
                     if not ok then
525
                           good := FALSE;
526
                           return;
527
                     end if;
528
              end loop;
529
              good := TRUE;
530
              value := bv;
531
       end OREAD;
532
 
533
 
534
       procedure OWRITE(L:inout LINE; VALUE:in BIT_VECTOR;
535
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
536
              variable tri: bit_vector(0 to 2);
537
              constant ne:  integer := value'length/3;
538
              variable bv:  bit_vector(0 to value'length-1) := value;
539
              variable s:   string(1 to ne);
540
       begin
541
              if value'length mod 3 /= 0 then
542
                     assert FALSE report
543
                           "OWRITE Error: Trying to read vector " &
544
                              "with an odd (non multiple of 3) length";
545
                     return;
546
              end if;
547
 
548
              for i in 0 to ne-1 loop
549
                     tri := bv(3*i to 3*i+2);
550
                     case tri is
551
                           when o"0" => s(i+1) := '0';
552
                           when o"1" => s(i+1) := '1';
553
                           when o"2" => s(i+1) := '2';
554
                           when o"3" => s(i+1) := '3';
555
                           when o"4" => s(i+1) := '4';
556
                           when o"5" => s(i+1) := '5';
557
                           when o"6" => s(i+1) := '6';
558
                           when o"7" => s(i+1) := '7';
559
                     end case;
560
              end loop;
561
              write(L, s, JUSTIFIED, FIELD);
562
       end OWRITE;
563
 
564
       -- Hex Read and Write procedures for STD_LOGIC_VECTOR
565
       procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR;GOOD:out BOOLEAN) is
566
              variable tmp: bit_vector(VALUE'length-1 downto 0);
567
       begin
568
              HREAD(L, tmp, GOOD);
569
              VALUE := To_X01(tmp);
570
       end HREAD;
571
 
572
       procedure HREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
573
              variable tmp: bit_vector(VALUE'length-1 downto 0);
574
       begin
575
              HREAD(L, tmp);
576
              VALUE := To_X01(tmp);
577
       end HREAD;
578
 
579
       procedure HWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
580
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
581
       begin
582
              HWRITE(L, To_bitvector(VALUE),JUSTIFIED, FIELD);
583
       end HWRITE;
584
 
585
       -- Hex Read and Write procedures for STD_LOGIC_VECTOR
586
 
587
       procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
588
              variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
589
       begin
590
              HREAD(L, tmp);
591
              VALUE := STD_LOGIC_VECTOR(tmp);
592
       end HREAD;
593
 
594
       procedure HREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
595
              variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
596
       begin
597
              HREAD(L, tmp, GOOD);
598
              VALUE := STD_LOGIC_VECTOR(tmp);
599
       end HREAD;
600
 
601
       procedure HWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
602
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
603
       begin
604
              HWRITE(L, To_bitvector(VALUE), JUSTIFIED, FIELD);
605
       end HWRITE;
606
 
607
 
608
       -- Octal Read and Write procedures for STD_ULOGIC_VECTOR
609
       procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR;GOOD:out BOOLEAN) is
610
              variable tmp: bit_vector(VALUE'length-1 downto 0);
611
       begin
612
              OREAD(L, tmp, GOOD);
613
              VALUE := To_X01(tmp);
614
       end OREAD;
615
 
616
       procedure OREAD(L:inout LINE; VALUE:out STD_ULOGIC_VECTOR) is
617
              variable tmp: bit_vector(VALUE'length-1 downto 0);
618
       begin
619
              OREAD(L, tmp);
620
              VALUE := To_X01(tmp);
621
       end OREAD;
622
 
623
       procedure OWRITE(L:inout LINE; VALUE:in STD_ULOGIC_VECTOR;
624
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
625
       begin
626
              OWRITE(L, To_bitvector(VALUE),JUSTIFIED, FIELD);
627
       end OWRITE;
628
 
629
       -- Octal Read and Write procedures for STD_LOGIC_VECTOR
630
 
631
       procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR) is
632
              variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
633
       begin
634
              OREAD(L, tmp);
635
              VALUE := STD_LOGIC_VECTOR(tmp);
636
       end OREAD;
637
 
638
       procedure OREAD(L:inout LINE; VALUE:out STD_LOGIC_VECTOR; GOOD: out BOOLEAN) is
639
              variable tmp: STD_ULOGIC_VECTOR(VALUE'length-1 downto 0);
640
       begin
641
              OREAD(L, tmp, GOOD);
642
              VALUE := STD_LOGIC_VECTOR(tmp);
643
       end OREAD;
644
 
645
       procedure OWRITE(L:inout LINE; VALUE:in STD_LOGIC_VECTOR;
646
                     JUSTIFIED:in SIDE := RIGHT; FIELD:in WIDTH := 0) is
647
       begin
648
              OWRITE(L, STD_ULOGIC_VECTOR(VALUE), JUSTIFIED, FIELD);
649
       end OWRITE;
650
 
651
 
652
--synopsys synthesis_on
653
end STD_LOGIC_TEXTIO;

powered by: WebSVN 2.1.0

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