File: Std.pm

package info (click to toggle)
libverilog-perl 3.460-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 4,188 kB
  • sloc: perl: 8,640; yacc: 3,362; cpp: 2,262; lex: 1,487; makefile: 8; fortran: 3
file content (135 lines) | stat: -rw-r--r-- 3,310 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# See copyright, etc in below POD section.
######################################################################

package Verilog::Std;
use Config;
use IO::File;
use File::Path;
use Verilog::Language;
use Carp;
use strict;

use vars qw($VERSION);

######################################################################
#### Configuration Section

$VERSION = '3.460';

#######################################################################
# It's a PITRA to have pure datafiles get installed properly, so we have
# the std text here in this package.

our $_Std_Text = <<EOF;
`line 1 "Perl_Verilog::Std_module" 0
// Verilog-Perl Verilog::Std
// The basis for this package is described in IEEE 1800-2017 Annex G
package std;

class semaphore;
   extern function new(int keyCount = 0);
   extern function void put(int keyCount = 1);
   extern task get(int keyCount = 1);
   extern function int try_get(int keyCount = 1);
endclass

class mailbox #(type T = dynamic_singular_type) ;
   extern function new(int bound = 0);
   extern function int num();
   extern task put( T message);
   extern function int try_put( T message);
   extern task get( ref T message );
   extern function int try_get( ref T message );
   extern task peek( ref T message );
   extern function int try_peek( ref T message );
endclass

class process;
   typedef enum { FINISHED, RUNNING, WAITING, SUSPENDED, KILLED } state;
   extern static function process self();
   extern function state status();
   extern function void kill();
   extern task await();
   extern function void suspend();
   extern function void resume();
endclass

// randomize is here, however the parsing rules are special,
// For example there is "(null)", variable arguments, and "with {...}"
// randomize really should be a language keyword.
function int randomize();
endfunction

endpackage : std

import std::*;

EOF

#######################################################################
# ACCESSORS

sub std {
    my $std = shift || Verilog::Language::language_standard();
    if ($std =~ /^1800/) {
	return $_Std_Text;
    } else {
	return "";
    }
}

#######################################################################
1;

=pod

=head1 NAME

Verilog::Std - SystemVerilog Built-in std Package Definition

=head1 SYNOPSIS

Internally used by Verilog::SigParser, etc.

   use Verilog::Std;
   print Verilog::Std::std;

=head1 DESCRIPTION

Verilog::Std contains the built-in "std" package required by the
SystemVerilog standard.

=head1 FUNCTIONS

=over 4

=item std({I<standard>})

Return the definition of the std package.  Optionally pass the language
standard, defaulting to what Verilog::Language::language_standard returns if
unspecified.

=back

=head1 DISTRIBUTION

Verilog-Perl is part of the L<http://www.veripool.org/> free Verilog EDA
software tool suite.  The latest version is available from CPAN and from
L<http://www.veripool.org/verilog-perl>.

Copyright 2009-2019 by Wilson Snyder.  This package is free software; you
can redistribute it and/or modify it under the terms of either the GNU
Lesser General Public License Version 3 or the Perl Artistic License
Version 2.0.

=head1 AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

=head1 SEE ALSO

L<Verilog-Perl>

=cut

######################################################################