Language(3)

πŸ’… Language(3) β€” the Verilog::Language era πŸ’…

okay bestie, welcome to the Verilog::Language glow-up ✨ this is the Language(3) page, the one your perl came with, and honestly it's giving "tiny module, big main character energy" πŸŽ€


🌸 NAME 🌸

Verilog::Language β€” Verilog language utilities. that's it, that's the whole vibe πŸ¦‹


✨ SYNOPSIS ✨

look, just look at these little one-liners, they're so clean 😭

  use Verilog::Language;

  $result = Verilog::Language::is_keyword("wire");  # true
  $result = Verilog::Language::is_compdirect("`notundef");  # false
  $result = Verilog::Language::number_value("4'b111");  # 8
  $result = Verilog::Language::number_bits("32'h1b");  # 32
  $result = Verilog::Language::number_signed("1'sh1");  # 1
  @vec    = Verilog::Language::split_bus("[31,5:4]");  # 31, 5, 4
  @vec    = Verilog::Language::split_bus_nocomma("[31:29]");  # 31, 30, 29
  $result = Verilog::Language::strip_comments("a/*b*/c");  # ac

no cap, those comments are literally the receipts πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

Verilog::Language is your lil toolbox of general utilities for using the Verilog Language πŸ’– parsing numbers? determining what keywords actually exist? yeah. all of that. and like, "General functions will be added as needed" β€” so bestie, the roster grows when it needs to grow 🌱


πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ’œ Verilog::Language::is_keyword($symbol_string)

returns true if the symbol string you handed it is a Verilog reserved keyword πŸ”₯ and the value it gives back tells you the language standard it belongs to, as per the begin_keywords macro: '1364-1995', '1364-2001', '1364-2005', '1800-2005', '1800-2009', '1800-2012', '1800-2017', '1800-2023', or 'VAMS'. she's thorough πŸ’…

πŸ’œ Verilog::Language::is_compdirect($symbol_string)

returns true if the given symbol string is a Verilog compiler directive ✨ simple as that.

πŸ’œ Verilog::Language::is_gateprim($symbol_string)

returns true if the symbol is a built-in gate primitive β€” like "buf", "xor", etc. etc. the OGs of gate life 🫢

πŸ’œ Verilog::Language::language_keywords($year)

returns a hash of the keywords for the given language standard year, where the value of the hash is the standard in which it was defined πŸŽ€ cute little key/value situation.

πŸ’œ Verilog::Language::language_standard($year)

sets the language standard so the module knows what counts as a keyword πŸ‘‘ if you pass undef, then all standards apply β€” everything is a keyword, we contain multitudes 😌 The year indicates the language standard as per the `begin_keywords macro: '1364-1995', '1364-2001', '1364-2005', '1800-2005' '1800-2009', '1800-2012', '1800-2017', or '1800-2023'.

πŸ’œ Verilog::Language::language_maximum

returns the greatest language currently standardized β€” presently '1800-2023'. she's the moment, she's the max, periodt πŸ’…

πŸ’œ Verilog::Language::number_bigint($number_string)

returns the numeric value of a Verilog value stored as a Math::BigInt, or undef if it's incorrectly formed 😭 btw you must use Math::BigInt yourself before calling this one, no free rides. also heads up β€” bigints don't have an exact size, so the NOT of a Math::BigInt may return a different value than verilog does πŸ™ˆ See also number_value and number_bitvector.

πŸ’œ Verilog::Language::number_bits($number_string)

returns the number of bits in a value string, or undef if it's incorrectly formed, or if it's not specified. note the or bestie, it's doing heavy lifting there 🧚

πŸ’œ Verilog::Language::number_bitvector($number_string)

returns the numeric value of a Verilog value stored as a Bit::Vector, or undef if it's incorrectly formed. and yes, you must use Bit::Vector yourself before calling this one too 🌸 the size of the Vector will be whatever number_bits returns. matched set, iconic.

πŸ’œ Verilog::Language::number_signed($number_string)

returns true if the Verilog value is signed, else undef. that's the whole function, she's lowkey minimal πŸ’€

πŸ’œ Verilog::Language::number_value($number_string)

returns the numeric value of a Verilog value, or undef if it's incorrectly formed. it ignores any signed Verilog attributes, but it is returned as a perl signed integer β€” so it may fail for values over 31 bits 😬 caution bestie. See also number_bigint and number_bitvector.

πŸ’œ Verilog::Language::split_bus($bus)

returns a list of expanded arrays πŸŽ€ pass it a string like "foo[5:1:2,10:9]" and it hands you back an array with ("foo[5]", "foo[3]", ...). it correctly handles connectivity expansion too, so "x[1:0] = y[3:0]" gets you intuitive results ✨ intuitive!! we love a function with emotional intelligence.

πŸ’œ Verilog::Language::split_bus_nocomma($bus)

same energy as split_bus, but faster 🏎️ caveat though β€” it only supports simple decimal colon-separated array specs, like "foo[3:0]". no comma chaos, she's not built for it πŸ’…

πŸ’œ Verilog::Language::strip_comments($text)

returns your text with any // or /**/ comments stripped out, correctly handling quoted strings πŸ”₯ and newlines are preserved in the process, so your line count survives the purge 🌈


πŸŽ€ DISTRIBUTION πŸŽ€

Verilog-Perl is part of the <https://www.veripool.org/> free Verilog EDA software tool suite πŸ’– the latest version is available from CPAN and from <https://www.veripool.org/verilog-perl>.

Copyright 2000-2024 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. legal bestie said what she said πŸ‘‘


🫢 AUTHORS 🫢

Wilson Snyder <wsnyder@wsnyder.org> β€” shoutout to the icon who made all this happen 🌟


🌈 SEE ALSO 🌈

  • Verilog-Perl
  • Verilog::EditFiles Verilog::Parser
  • Verilog::ParseSig
  • Verilog::Getopt

and the <https://www.veripool.org/verilog-mode> Verilog-Mode package for Emacs 🧚 like if you're an Emacs girlie, that one's for you.


alright bestie, that's the page πŸ’… brought to you by perl v5.42.0, dated 2025-07-25 β€” that's the Language(3) footer, now go parse some numbers, you absolute legend β­πŸ“πŸ’œ

πŸ“¦ where this page comes from