sample input file
input [31:0] ucast_mem_wdata; input [31:0] ucast_mem_wren; input ucast_mem_wr; input ucast_mem_rd; output [31:0] ucast_mem_rdata; wire [BMU_MEM_ADDR_BITS-1:0] mem_addr; always @ (posedge sys_clk +or negedge sys_reset_n) begin if (!sys_reset_n) ucast_int_mem_rd_r <= 0; else ucast_int_mem_rd_r <= ucast_int_mem_rd &amp; !ucast_access; end endmodule
From this what i have to do is,i have to read input,output,always,and initial blocks and have to send them seperate files ie input to input_in,output_out,always to alway_all;

I am having the pblm at reading always block as it is so many internal blocks

could u anybody tell me how to read entire always block and write it to the socalled named file THis is the code I tried for input and out put reading

but i couldnt get any idea regarding the reading of whole always blcok for the above

your attempt from ravi030's scratchpad

#!usr/bin/perl use strict; use warnings; open( my $ip_fileh, '<', "D:\\PacketProcessor\\rtl\\common\\gen_sync_fifo.v" ) || die ( "unable to open the file D:\\PacketProcessor\\rtl\\common\\gen_sync_fifo.v\n" ); #open the file while (<$ip_fileh>) { #read the file line by line my $str = $_; #assign to a variable chomp $str; #remove the new line if ( $str =~ m/(Input|output) ((\w+(,\s*\w+)*)|([^\n]*))/i ) { my $type = $1; #get whether input or output my @inp_vals = split /\,\s*/, $2; #split by comma followed +by space if more than one values local $" = "\n"; #to print the array values line by line print "$type\n@inp_vals \n"; #print the output } } __END__

In reply to Re: Reading block by Anonymous Monk
in thread Reading block by ravi030

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.