Enumerating Text

Code Roar provides an option to enumerate lines of text. The enumeration of text is available from the Text menu via the Enumerate Selected Text option. It will only be enabled if a block of text is selected. More information on using the associated dialog may be found in the description of the Enumerate text dialog. The following examples provide tips on how to use the enumeration feature built into Code Roar.

Example: Enumerating a simple list

For example, say we had a list of thresholds as shown in the list below:

 

    

 

We want to assign a value to each of our thresholds such that the values range from 0 to 100 with increments of 20 as shown in the figure below:

 

   

 

We could type this manually which is alright in a short list or we might decide to use the Enumerate Text feature to do it for us.

 

To perform this enumeration:

 

  1. select the text that you want to enumerate as follows:

 

        

 

  1. Then from the Text menu select the Enumerate Selected text operation. This will show the Enumerate text dialog:

    

        

 

  1. In the dialog set the Prefix to the = to add an equal sign between our threshold and the value we are assigning it. Set the Postfix to a , so that we can separate our values by commas because we want to use this set of numbers in an enumeration. Select End of Line as the placement option. This places our enumerated value after our THRESHOLD_A instead of at the beginning of the line. Finally select our base as Dec for decimal. Press the execute button to display the enumeration as follows:

 

        

 

Example: Creating a set of Bit Vectors

In this example we are going to create a set of bit vectors which may be useful when building a test bench. We want our vectors to range from 1 to 50 with the value displayed in binary as shown in the figure below:

 

     

 

To perform this enumeration:

 

  1. select the text that you want to enumerate as follows:

 

        

 

  1. Then from the Text menu select the Enumerate Selected text operation. This will show the Enumerate text dialog:

    

        

 

  1. In the dialog set the Prefix to the = 0b to add an equal sign and a binary indicator between our vector and the value we are assigning it. Set the Postfix to a semicolon ; to finish the definition of each vector. Select End of Line as the placement option. This places our enumerated value after our VECTOR_X instead of at the beginning of the line. Finally select our base as Bin for binary. Press the execute button to display the enumeration as follows: