Sed command to create a verilog blackbox

I recently had to create black boxes for 28 verilog modules. I could have done it manually, but thought of using some sed scripting, and it sure got done in a flash.

This is the sed command I used.

sed -i".bak" -n -e '/module/p' -e '/output/p' -e '/input/p' bb.v

where bb.v is the blackbox file.

In my case, I had already created copies of my verilog.v file as bb.v, and I then went about editing the bb.v files. One can also perform the copying and editing in a single step as follows

sed -n -e '/module/p' -e '/output/p' -e '/input/p' verilog.v > bb.v

The

-i".bak"

switch is a way of telling sed that the substitution. printing, deletion have to be done in-place

Advertisements
Sed command to create a verilog blackbox

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s