SMOK

The <code>SMOK</code> .ini File

Last modified: April 12, 2005
Sloop Cebollita
  CSE Home  About Us    Search    Contact Info 
  1. General Description
  2. Hierarchical Cost Name Space
  3. Cost Expressions
  4. When and Where (smok.ini as a Windows file)

General Description

The smok.ini file defines component time and space costs.  These are used by SMOK to report model costs (in the Title component).  Here's a small example:

ADDER  80  32
ALU  144  34
ANDGATE  2  1

The first column is the cost class name, the second column is its space cost, and the third  is its time cost.  Names are case insensitive.  Costs are integers in arbitrary units.  SMOK makes no internal use of these costs except to generate cost summaries in the Title component.  (That is, these costs are annotations only, and have no functional effect on the simulation.)

The .ini file can include comments delimited by "#", as in

# These are the cost definitions for the SMOK package components.

Comments run from the delimiter ("#") through the end of the line.

Hierarchical Cost Name Space

The smok.ini file can be used to create a hierarchical name space of costs.  For example,

Memory  100 10
Memory:SRAM 200 5
Memory:DRAM 50 15

The character ':' separates segments of a single hierarchical name.  The first segment must be one of the built-in functional component types.  Name segments after that are arbitrary.  Only names for which costs have been defined may be assigned to components.  For example, the single definition

MemoryVRAM:X3022     52   12

will allow Memory components in the SMOK model to be assigned cost type Memory:VRAM:X3022, but this line alone makes no definition for Memory:VRAM and so that name could not be used to associate costs with model components.

The user can change the type of a component in a SMOK model to any type whose root (functional) segment is the same as the functional type of that component.  That is, you can edit a Memory component to assign a new Memory:... cost, but not an ALU:... cost.

The cost name associated with each component is saved when the model is saved.  However, the definition of that cost name is not saved with the model; it resides only in the smok.ini file.

Cost Expressions

Typically, component costs are functions of their "size".  SMOK allows costs specifications as functions, and provides two built-in variables that reflect a component's size:

S The "natural size" of the component.
For most components, this is 1.
For register file components, this is the number of registers.
For memory components, this is the memory size.
W The component width (in bits).

Thus, the line

RegisterFile    80+S*W*10    10+S

says that the space cost of a register file component is 80 plus the product of the number of registers it has, the number of bits per register, and the constant 10.  The time delay is 10 plus the number of registers.

Cost expressions are applied on a per component basis.  While the expression is defined for a class of component, it is evaluated individually for each component using that component's size and width parameters.

Expression operators are +, -, *, /, and ^ (exponentiation).  There are no unary operators, including no unary minus. 

Expressions can be parenthesized.

Because there is no expression terminator character, SMOK is a bit particular about the use of embedded spaces in expressions.  In particular, embedded spaces are allowed only within matching parentheses.

Thus,

RegisterFile    ( 80  + S*(W*10) )   10+S

is legal, but

RegisterFile    80  +  S*W*10    10+S

is not.

When and Where

SMOK tries to read a file named "smok.ini" each time a new SMOK machine is created. (A new machine is created on startup, each time a new model file is read, and when the user deletes the current model though the UI.) When looking for a smok.ini file, the search path given by the SMOKINIPATH environment variable is used. You may use "." in the usual way in this path to indicate the directory in which the model (.smok) file was found. This allows a different smok.ini to be associated with each model by isolating each model/smok.ini pair in a separate directory.

If no smok.ini file is found, default costs of 1 for space and 2 for time are used for all component types.

The smok.ini file is NOT updated when the user changes a component cost for some particular model through the UI.  If a permanent change is required, the smok.ini file must be edited outside of SMOK.

 


Department of Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to zahorjan@cs.washington.edu]