Arbitrating Between Clock Domains
When two domains request a shared resource, an arbiter with CDC gates the requests:
// Request from domain A
assign req_a_sync = req_a; // Synchronize to slow clock
sync_2ff req_a_sync_inst (.in(req_a), .out(req_a_sync), .clk(slow_clk));
// Arbiter grants one at a time
always @(posedge slow_clk) begin
if (req_a_sync && ~grant_b) grant_a <= 1;
else if (req_b && ~grant_a) grant_a <= 0;
end
// Grant sync back to fast domain
sync_2ff grant_sync_inst (.in(grant_a), .out(grant_a_sync_fast), .clk(clk_a));Key Takeaways
- ✅ Arbiters need CDC at request and grant
- ✅ Serialize domain requests
Day 9: Clock gating across domains.