24.04.2013 Views

Verification of Parameterised FPGA Circuit Descriptions with Layout ...

Verification of Parameterised FPGA Circuit Descriptions with Layout ...

Verification of Parameterised FPGA Circuit Descriptions with Layout ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3. GENERATING PARAMETERISED LIBRARIES WITH LAYOUT 61<br />

3.7.5 Expression Simplification<br />

After height() and width() functions have been eliminated the result is valid Pebble ex-<br />

pressions, however these are <strong>of</strong>ten significantly more complex than necessary and can be<br />

extensively simplified - for example, maxf(j = 0..5, 3) can be simplified to just 3. The Quartz<br />

compiler already possesses a sophisticated logic optimiser which simplifies simple logical and<br />

arithmetic expressions such as x + y − y and also evaluates any expressions where the result<br />

is known, such as 4 + 5 × 2.<br />

The logic optimiser is extended to implement the evaluation <strong>of</strong> max, if, maxf and sum expres-<br />

sion types when all parameters are known. Since we are generating parameterised Pebble<br />

output it is <strong>of</strong>ten the case that functions can not be fully evaluated and in these circumstances<br />

a range <strong>of</strong> transformations are applied to simplify expressions.<br />

Uses <strong>of</strong> if can be simplified if the conditional test can be evaluated statically. Uses <strong>of</strong> max<br />

are simplified to remove any values which are known to be less than or equal to another<br />

value (remaining as a parameter). For example, max(a, b, 4, 5, a + 2) can be simplified to<br />

max(b, 5, a + 2) since a + 2 > a and 5 > 4 always. These relationships can be determined<br />

using the logic optimiser itself to investigate whether x > y can be simplified to true or false<br />

for each pair x and y <strong>of</strong> parameters.<br />

sum and maxf are more complex functions to simplify. A number <strong>of</strong> generic transformations<br />

have been developed for expressions involving these functions and these transformations are<br />

applied by the optimiser where possible. The transformations applied to sum are:<br />

n < m ⇒ sum(i = m..n, f) = 0<br />

m ≤ n ⇒ sum(i = m..n, f) = (n − m + 1) × f<br />

i /∈ f ⇒ sum(i = m..n, f) = if(m ≤ n, (n − m + 1) × f, 0)<br />

While similar transformations are applied to maxf:<br />

n < m ⇒ maxf(i = m..n, f) = 0<br />

i /∈ f ⇒ maxf(i = m..n, f) = if(m ≤ n, f, 0)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!