Fit four peripheral regions behind a proposed second bridge while preserving the existing firmware addresses.
Hardware context: ap_soc peripheral allocation. Firmware-compatible peripheral expansion
A proposed expansion adds a separate 64 KiB bridge at 0x20000000. Its sixteen pages are 4 KiB each. FIRST is the first available page, from 0 through 8. Earlier pages are occupied. If the four regions cannot all fit, report 16 for every base.
Place TRACE, MAIL, CAPTURE and FLAGS in that order. Use the earliest naturally aligned start at or after the previous end. Leave any skipped pages free.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
first | 4 | input of each check |
Full specification
| Region | Pages |
|---|---|
| TRACE | 2 |
| 1 | |
| CAPTURE | 4 |
| FLAGS | 1 |
Examples
Example 1
Start at Page 0- Input
FIRST = 0
- Output
trace = 0, mail = 2, capture = 4, flags = 8
Round each new base up to its own page boundary.
Example 2
Start at Page 1- Input
FIRST = 1
- Output
trace = 2, mail = 4, capture = 8, flags = 12
Round each new base up to its own page boundary.
Example 3
Start at Page 8- Input
FIRST = 8
- Output
trace = 16, mail = 16, capture = 16, flags = 16
Alignment consumes the remaining room. Reject the whole placement.
Constraints and Contract
- Keep the four named elaboration constants and the FIRST parameter. Return page indices from the bridge base. Do not wrap or backfill alignment gaps.
Hints
Hint 1
Work in pages first.
Hint 2
Try a prefix that ends on an odd page.
Hint 3
The next free page is one beyond the last occupied page.
What the grader checks: All nine supported prefixes and the elaboration-time constant interface are checked.
12 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 3 problems on this path