Skip to content

Commit

Permalink
ice40: Add set_frequency pcf command; and document pcf
Browse files Browse the repository at this point in the history
Signed-off-by: David Shah <dave@ds0.me>
  • Loading branch information
gatecat committed Oct 13, 2019
1 parent ee76942 commit 8c0610e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/ice40.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# iCE40 Architecture Documentation

## PCF format reference

PCF files contain physical constraints and are specified using the `--pcf` argument. Each (non blank) line contains a command; lines beginning with `#` are comments.

Two commands are supported: `set_io` and `set_frequency`.

set_io [-nowarn] [-pullup yes|no] [-pullup_resistor 3P3K|6P8K|10K|100K] port pin

Constrains named port `port` to package pin `pin`. `-nowarn` disables the warning if `port` does not exist. `-pullup yes` can be used to enable the built in pullup for all iCE40 devices. `-pullup_resistor` sets the pullup strength, and is available on iCE40 UltraPlus only.

set_frequency net frequency

Adds a clock constraint to a named net (any alias for the net can be used). `frequency` is in MHz.

_Note that this is a non-standard extension, not supported by the vendor toolchain. It allows specifying clock constraints without needing the Python API._
4 changes: 4 additions & 0 deletions ice40/pcf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ bool apply_pcf(Context *ctx, std::string filename, std::istream &in)
for (const auto &attr : extra_attrs)
fnd_cell->second->attrs[attr.first] = attr.second;
}
} else if (cmd == "set_frequency") {
if (words.size() < 3)
log_error("expected PCF syntax 'set_frequency net frequency' (on line %d)\n", lineno);
ctx->addClock(ctx->id(words.at(1)), std::stof(words.at(2)));
} else {
log_error("unsupported PCF command '%s' (on line %d)\n", cmd.c_str(), lineno);
}
Expand Down

0 comments on commit 8c0610e

Please sign in to comment.