in reply to Reading block

Use the diamond operator to read the file/data. When a line starts with "//always" it triggers the begin of the block. You can use a Regular Expression to test this. Keep reading until you encounter an "//end" it's the end of the block. This should be straightforward.

Update

Something you can play with. You'll get the idea.

use strict; use warnings; while (my $line=<DATA>){ if ($line =~ /\/\/always/){ print "Start of block\n"; } if ($line =~ /end\/\//) { print "End of block\n"; } } __DATA__ 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 & !ucast_access; end// this is the always block which i have to read into another +file