Sponsored Content
Top Forums Shell Programming and Scripting perl help to split big verilog file into smaller ones for each module Post 302315589 by vgersh99 on Tuesday 12th of May 2009 08:21:58 PM
Old 05-12-2009
Code:
awk -F '[ (]' '$1 == "module" { file= $2 ".v" } file != ""{print > file} $1 == "endmodule" {close(file); file=""}' intxt.txt

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Split a big file into two others files

Hello, i have a very big file that has more then 80 MBytes (100MBytes). So with my CVS Application I cannot commit this file (too Big) because it must have < 80 MBytes. How can I split this file into two others files, i think the AIX Unix command : split -b can do that, buit how is the right... (2 Replies)
Discussion started by: steiner
2 Replies

2. Shell Programming and Scripting

Segment a big file into smaller ones

Greeting to all. I have big text file that I would like to segment into many smaller files. Each file should be maximum 10 000 lines. The file is called time.txt. after the execution of the file I would like to have. time_01.txt, time_02, txt, ...,time_n.txt Can anybody help. Br. (2 Replies)
Discussion started by: flash80
2 Replies

3. Shell Programming and Scripting

parsing data from a big file using keys from another smaller file

Hi, I have 2 files format of file 1 is: a1 b2 a2 c2 d1 f3 format of file 2 is (tab delimited): a1 1.2 0.5 0.06 0.7 0.9 1 0.023 a3 0.91 0.007 0.12 0.34 0.45 1 0.7 a2 1.05 2.3 0.25 1 0.9 0.3 0.091 b1 1 5.4 0.3 9.2 0.3 0.2 0.1 b2 3 5 7 0.9 1 9 0 1 b3 0.001 1 2.3 4.6 8.9 10 0 1 0... (10 Replies)
Discussion started by: Lucky Ali
10 Replies

4. Shell Programming and Scripting

Split large file into smaller file

hi Guys i need some help here.. i have a file which has > 800,000 lines in it. I need to split this file into smaller files with 25000 lines each. please help thanks (1 Reply)
Discussion started by: sitaldip
1 Replies

5. Shell Programming and Scripting

How to split a file into smaller files

Hi, I have a big text file with m columns and n rows. The format is like: STF123450001000200030004STF123450005000600070008STF123450009001000110012 STF234560345002208330154STF234590705620600070080STF234567804094562357688 STF356780001000200030004STF356780005000600070080STF356780800094562657687... (2 Replies)
Discussion started by: wintersnow2011
2 Replies

6. Shell Programming and Scripting

Help needed - Split large file into smaller files based on pattern match

Help needed urgently please. I have a large file - a few hundred thousand lines. Sample CP START ACCOUNT 1234556 name 1 CP END ACCOUNT CP START ACCOUNT 2224444 name 1 CP END ACCOUNT CP START ACCOUNT 333344444 name 1 CP END ACCOUNT I need to split this file each time "CP START... (7 Replies)
Discussion started by: frustrated1
7 Replies

7. HP-UX

How to split big file on HP-UX and join on Windows?

Hi HP-admins, I have 120GB file on HP-UX and need to split to 4GB pieces and join them on Windows. As I don't want to use zipsplit, tried to use split command and join on windows using "copy /b" but it doesn't work (It merges and creates new file but file is corrupt) What is the correct... (6 Replies)
Discussion started by: prvnrk
6 Replies

8. UNIX for Dummies Questions & Answers

Split large file to smaller fastly

hi , I have a requirement input file: 1 1111111111111 108 1 1111111111111 109 1 1111111111111 109 1 1111111111111 110 1 1111111111111 111 1 1111111111111 111 1 1111111111111 111 1 1111111111111 112 1 1111111111111 112 1 1111111111111 112 The output should be, (19 Replies)
Discussion started by: mechvijays
19 Replies

9. UNIX for Dummies Questions & Answers

Split files into smaller ones with 1000 hierarchies in a single file.

input file: AD,00,--,---,---,---,---,---,---,--,--,--- AM,000,---,---,---,---,---,--- AR, ,---,--,---,--- AA,---,---,---,--- AT,--- AU,---,---,--- AS,---,--- AP,---,---,--- AI,--- AD,00,---,---,---, ,---,---,---,---,---,--- AM,000,---,---,--- AR,... (6 Replies)
Discussion started by: kcdg859
6 Replies

10. UNIX for Beginners Questions & Answers

Split large file into smaller files without disturbing the entry chunks

Dears, Need you help with the below file manipulation. I want to split the file into 8 smaller files but without cutting/disturbing the entries (meaning every small file should start with a entry and end with an empty line). It will be helpful if you can provide a one liner command for this... (12 Replies)
Discussion started by: Kamesh G
12 Replies
SigParser(3pm)						User Contributed Perl Documentation					    SigParser(3pm)

NAME
Verilog::SigParser - Signal Parsing for Verilog language files SYNOPSIS
use Verilog::Preproc; use Verilog::SigParser; my $pp = Verilog::Preproc->new(keep_comments=>0,); my $parser = new Verilog::SigParser; $parser->parse_preproc_file ($pp); # The below described callbacks are then invoked DESCRIPTION
Verilog::SigParser builds upon the Verilog::Parser module to provide callbacks for when a signal is declared, a module instantiated, or a module defined. See the "Which Package" section of Verilog::Language if you are unsure which parsing package to use for a new application. For a higher level interface to this package, see Verilog::Netlist. METHODS
The method interface to Verilog::SigParser is described in the Verilog::Parser module which this package inherits. You will probably want to use the preprocessing option of Verilog::Parser with this package. CALLBACKS
In order to make the parser do anything interesting, you must make a subclass where you override one or more of the following methods as appropriate. Note Verilog::Parser callbacks also are invoked when SigParser is parsing. $self->attribute ( $text ) Scanned an attribute or meta-comment. The parser inspects the first word of each comment line ("//key rest" to end of line) or comment block ("/*key rest */). It calls "$self-"attribute( meta_text )" if the first word has a true value in hash "$self-"metacomment>. $self->class ( $token, $name, $virtual ) This method is called at a class. $self->covergroup ( $token, $name ) This method is called at a covergroup. $self->contassign ( $token, $lhs, $rhs ) This method is called at a continuous "assign" keyword, with the left and right hand part of the assignment. Note that "wire" initializations are not considered assignments; those are received via the var callback's value parameter. $self->defparam ( $token, $lhs, $rhs ) This method is called at a "defparam" keyword, with the left and right hand part of the assignment. $self->endcell ( $token ) This method is called at the end of defining a cell. It is useful for writing clean up routines. $self->endgroup ( $token ) This method is called at the end of defining a covergroup. It is useful for writing clean up routines. $self->endinterface ( $token ) This method is called at a endinterface keyword. It is useful for writing clean up routines. $self->endclass ( $token ) This method is called at a endclass keyword. It is useful for writing clean up routines. $self->endtaskfunc ( $token ) This method is called at a endfunction or endtask keyword. It is useful for writing clean up routines. $self->endmodport ( $token ) This method is called at a endmodport keyword. It is useful for writing clean up routines. $self->endmodule ( $token ) This method is called at a endmodule keyword. It is useful for writing clean up routines. $self->endpackage ( $token ) This method is called at a endpackage keyword. It is useful for writing clean up routines. $self->endprogram ( $token ) This method is called at a endprogram keyword. It is useful for writing clean up routines. $self->function ( $keyword, $name, $data-type ) This method is called when a function is defined. Type is the output size or typename, plus "signed", for example "", "[3:0]", "integer", or "signed [2:0]". $self->import ( $package, $id ) This method is called when an import is defined. $self->instant ( $module, $cell, $range ) This method is called when a instantiation is defined. The first parameter is the name of the module being instantiated. The second parameter is the name of the cell, which may be "" for primitives. The third is the range if the cell was arrayed. Prior to version 3.000, the name of the parameters were also included in this callback. This has been replaced with the parampin callback. $self->interface ( $keyword, $name ) This method is called when an interface is defined. $self->modport ( $keyword, $name ) This method is called when an interface modport is defined. $self->module ( $keyword, $name, ignored, $in_celldefine ) This method is called when a module is defined. $self->package ( $keyword, $name ) This method is called when a package is defined. $self->parampin ( $name, $connection, $index ) This method is called when a parameter is connected to an instantiation, IE the "#(...)" syntax. It is also used for UDP delays (Three calls for "#(delay0,delay1,delay2)"), as the parser does not know if the instantiation is for an UDP versus a module. $self->pin ( $name, $connection, $index ) This method is called when a pin on a instant is defined. If a pin name was not provided and the connection is by position, name will be '' or undef. If you do not need the pin nor var nor port callbacks, consider the "$self->new (... use_vars=>0 ...)" option to accelerate parsing. $self->port ( $name, $objof, $direction, $data_type, $array, $pinnum ) This method is called when a module port is defined. It may be called twice on a port if the 1995 style is used; the first call is made at the port header, the second call at the input/output declaration. The first argument $name, is the name of the port. $objof is what the port is an object of ('module', 'function', etc). $direction is the port direction ('input', 'output', 'inout', 'ref', 'const ref', or 'interface'). $data_type is the data type ('reg', 'user_type_t', 'signed [31:0]', etc, or for interfaces the "{interface_id}.{modport_name}"). $array is the arraying of the port ('[1:0][2:0]', '', etc). $pinnum is set to the pin number for ANSI style declarations, and 0 for Verilog 1995 declarations made outside the port list. If you do not need the pin nor var nor port callbacks, consider the "$self->new (... use_vars=>0 ...)" option to accelerate parsing. $self->ppdefine ( $defvar, $definition ) This method is called when a preprocessor definition is encountered. $self->program ( $keyword, $name ) This method is called when a program is defined. $self->signal_decl ( $keyword, $signame, $vector, $mem, $signed, $value ) This method is no longer used, see $self->var. $self->task ( $keyword, $name ) This method is called when a task is defined. $self->var ( $kwd, $name, $objof, $nettype, $data_type, $array, $value ) This method is called when a variable or net is defined. The first argument $kwd is how it was declared ('port', 'var', 'genvar', 'parameter', 'localparam', 'typedef') or if applicable a net type ('supply0', 'wire', etc). $name is the name of the variable. $objof is what the variable is an object of ('module', 'function', etc). $nettype is the net type if any was defined ('', 'supply0', 'wire', 'tri', etc). $data_type is the data type ('user_type_t', '[31:0] signed', etc). $array is the arraying of the variable which is the text AFTER the variable name ('[1:0][2:0]', '', etc). $value is what the variable was assigned to ('', or expression). Note typedefs are included here, because "parameter type" is both a variable and a type declaration. If you do not need the pin nor var nor port callbacks, consider the "$self->new (... use_vars=>0 ...)" option to accelerate parsing. Below are some example declarations and the callbacks: reg [4:0] vect = 5'b10100; # VAR 'var' 'vect' 'module' '' 'reg [4:0]' '' '5'b10100' wire (weak0, weak1) value = pullval; # VAR 'net' 'value' 'module' 'wire' '' '' 'pullval' reg [1:0] mem [12:2]; # VAR 'var' 'mem' 'module' '' 'reg [1:0]' '[12:2]' '' int n[1:2][1:3] = '{'{0,1,2}, '{3{4}}}; # verilog/parser_sv.v:121: VAR 'var' 'n' 'module' '' 'int' '[1:2][1:3]' ''{'{0,1,2},'{3}}' module ( output logic [SZ-1:0] o_sized ); # VAR 'port' 'o_sized' 'module' '' 'logic [SZ-1:0]' '' '' struct packed signed { bit [7:0] m_b; }; # VAR 'member' 'm_b' 'struct' '' 'bit [7:0]' '' '' BUGS
This is being distributed as a baseline for future contributions. Don't expect a lot, the Parser is still naive, and there are many awkward cases that aren't covered. Note the SigParser is focused on extracting signal information. It does NOT extract enough information to derive general interconnect; for example the contents of 'assign' statements are not parsed. DISTRIBUTION
Verilog-Perl is part of the <http://www.veripool.org/> free Verilog EDA software tool suite. The latest version is available from CPAN and from http://www.veripool.org/verilog-perl <http://www.veripool.org/verilog-perl>. Copyright 2000-2012 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. AUTHORS
Wilson Snyder <wsnyder@wsnyder.org> SEE ALSO
Verilog-Perl, Verilog::Parser, Verilog::Language, Verilog::Netlist, Verilog::Getopt perl v5.14.2 2012-05-04 SigParser(3pm)
All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy