The Full Slice: What a Cut Costs and Where to Put It

A slice buys clock speed and charges for it in three coins: cycles, flip-flops and, if you choose badly, half your throughput.

You Will Be Able To

  • Describe a full slice, and say why it still moves one beat in every cycle.
  • Count what slices cost a transfer in latency, and a design in flip-flops.
  • Choose where to cut a path of several hops so that every piece fits the clock period.
Lesson
S4.16
Time
26 min
Runs on
Your browser
Check
5 questions

A team adds a small slice to the path between a DMA block and memory. Timing passes, and so does every test. A month later the copy of a large buffer takes twice as long as planned. Nothing is broken: the slice they chose can carry a beat only in every second cycle.

Before You Start

You need the forward slice and the backward slice from Register Slices. That page also gave the two paths of a channel, the spare register, and one cycle of latency for each slice.

Five questions this page answers
Question
1What is inside a full slice, and how many beats can it hold?
2How does a full slice keep one beat per cycle, when a single register cannot?
3What do slices add to the latency of a read?
4How do you choose where to cut a path of several hops?
5Which paths of a chip should have no slice at all?

The Idea: Cut Both Paths, Then Count the Cost

A forward slice cuts the forward path and lets ready through. A backward slice cuts ready and lets the beat through. Put one after the other and no signal crosses as logic. That pair is a full slice.

A full slice holds up to two beats: one in its main register, one in its spare register. Because of the second place, it can take a new beat in every cycle and give one in every cycle. Its throughput, the number of beats per cycle, is still one.

A cheaper circuit also cuts both paths: one register that says "ready" only while it is empty. It needs a cycle to fill and a cycle to empty. So it carries one beat in every second cycle. This page calls it a half-rate slice.

Every slice has a price. It adds a cycle of latency to each beat that crosses it. It adds flip-flops. The work of the architect is to place as few as will make every path fit the clock period.

New Words

New words on this page
WordMeaning
Full sliceA slice that cuts both paths of a channel. It holds two beats and moves one beat per cycle.
Half-rate sliceOne register that is ready only while empty. It cuts both paths and moves one beat in two cycles.
ThroughputThe number of beats a channel moves per clock cycle, when both ends are willing.
SegmentThe part of a path between two cuts, or between a cut and an end of the path.

One Picture: Two Registers

Inside a Full Slice: Two RegistersStep through the picture. Beats enter on the left and leave on the right.
  • Processor
  • Control / FSM
  • Bus
  • Memory
Inside a Full Slice: Two RegistersStep through the picture. Beats enter on the left and leave on the right. component Sender sees a ready thatcomes from a flip-flop component Spare register empty in normalrunning component Main register every beat passesthrough it component Receiver sees a valid and apayload that comefrom flip-flops beatbeat, when main isstuckthe waiting beatbeat
  1. component Sendersees a ready that comes from a flip-flop
    • beat → Main register
    • beat, when main is stuck → Spare register
  2. component Main registerevery beat passes through it
    • beat → Receiver
  3. component Receiversees a valid and a payload that come from flip-flops
  4. component Spare registerempty in normal running
    • the waiting beat → Main register
  1. Normal running

    The receiver is ready. At every edge the main register passes one beat on and loads the next. One beat in, one beat out.

  2. The receiver stops

    The main register keeps its beat. The sender does not know yet, and hands over one more. The spare register takes it.

  3. Both registers full

    Now the slice holds two beats. Its ready to the sender falls. That ready comes from a flip-flop, and so does everything the receiver sees.

  4. The receiver goes on

    It takes the beat of the main register. The waiting beat moves across. One edge later the sender may hand over again.

Read the diagram as text
  • Sender: sees a ready that comes from a flip-flop
  • Spare register: empty in normal running
  • Main register: every beat passes through it
  • Receiver: sees a valid and a payload that come from flip-flops
  • Sender → Main register: beat
  • Sender → Spare register: beat, when main is stuck
  • Spare register → Main register: the waiting beat
  • Main register → Receiver: beat

A full slice is a backward slice followed by a forward slice. No wire crosses it as logic, in either direction.

The spare register is empty nearly all the time. It earns its place in the one cycle after the receiver stops.

The Smallest Example, Worked by Hand: Where to Cut

A read address travels from a manager to a memory through four hops. The clock period is 7 ns. The delays of the hops are in the table.

One path of four hops
Hop1234Sum
Delay, in ns324312

The whole path takes 12 ns, and the period is 7 ns. So it fails. One cut gives two segments. There are three places for it.

One cut, three places
Cut after hopFirst segmentSecond segmentLongestFits 7 ns?
132 + 4 + 3 = 99no
23 + 2 = 54 + 3 = 77yes
33 + 2 + 4 = 939no

Only the cut after hop 2 works. It is the place that makes the longest segment as short as it can be. Now the cost. The read address takes one cycle more. If the reply comes back along the same hops, its channel needs a cut too. Request and reply together then take two cycles more.

The Rules

  1. Rule 1: A full slice lets no signal cross it as logic.

    Valid, the payload and ready all leave it from flip-flops.

  2. Rule 2: A full slice moves one beat per cycle.

    It can, because it has two places. One register that cuts both paths moves one beat in two cycles.

  3. Rule 3: Each slice adds one cycle to each beat that crosses it.

    A request and its reply use two channels. Together they cross the slices of both.

  4. Rule 4: A slice costs one register of payload width, and a full slice two.

    Wide channels, such as read data, are the expensive ones to cut.

  5. Rule 5: Cut so that the longest segment is as short as possible.

    A cut near one end leaves the other segment almost as long as before.

  6. Rule 6: Leave the fastest route of the chip without a slice.

    A processor waits for every access to its memory. A slow device does not notice one more cycle.

Sources for These Rules

Arm AMBA AXI Protocol Specification, document IHI 0022, issue L, section A2.5. Any number of register stages may sit on the valid and ready paths. Channels may differ in their number of stages, and each stage costs a cycle of latency. The same section describes a direct connection from a processor to fast memory, with slices on the longer paths to slower devices.

How a full slice and a half-rate slice are built, and rules 4 and 5, are common practice. The specification does not describe them.

Now Run It

The lab at the end of this page has a full slice in the middle of the channel. The sender has six beats. The receiver is not ready at e4.

Recorded from the lab on Icarus. The word "up" marks the sender's side of the slice, and "down" the receiver's side.
e1 up: valid=1 data=a1 ready=1 | down: valid=0 data=xx ready=1 | handed over a1, taken --
e2 up: valid=1 data=a2 ready=1 | down: valid=1 data=a1 ready=1 | handed over a2, taken a1
e3 up: valid=1 data=a3 ready=1 | down: valid=1 data=a2 ready=1 | handed over a3, taken a2
e4 up: valid=1 data=a4 ready=1 | down: valid=1 data=a3 ready=0 | handed over a4, taken --
e5 up: valid=1 data=a5 ready=0 | down: valid=1 data=a3 ready=1 | handed over --, taken a3
e6 up: valid=1 data=a5 ready=1 | down: valid=1 data=a4 ready=1 | handed over a5, taken a4
e7 up: valid=1 data=a6 ready=1 | down: valid=1 data=a5 ready=1 | handed over a6, taken a5
e8 up: valid=0 data=a7 ready=1 | down: valid=1 data=a6 ready=1 | handed over --, taken a6
e9 up: valid=0 data=a7 ready=1 | down: valid=0 data=a7 ready=1 | handed over --, taken --
e10 up: valid=0 data=a7 ready=1 | down: valid=0 data=a7 ready=1 | handed over --, taken --
handed over 6, taken 6: a1 a2 a3 a4 a5 a6
last beat taken at e8

Rule 3 at work: a1 is handed over at e1 and taken at e2. The picture at work: at e4 the receiver stops, and the sender still hands over a4, which goes to the spare register. At e5 the sender sees ready at 0.

Rule 2 needs a receiver that never stops. The next table has three runs of six beats each.

Six beats, receiver always ready
In the middle of the channelLast line of the labEdges per beat
wires onlylast beat taken at e61
a full slicelast beat taken at e71
a half-rate slicelast beat taken at e122

Recorded from the lab. Change full_slice to half_slice in the lab to get the third run.

The full slice ends one edge later than the wires: that is its latency, paid once. The half-rate slice ends at e12. It pays one extra edge for every beat.

Now the paths. The last page measured a design of two hops with a synthesis tool. Here is the full table.

The two-hop design, measured
Between the two hopsLongest path, in logic levelsFlip-flops
nothing15136
a forward slice9153
a backward slice19153
a full slice10170

Measured with Yosys 0.70+290, generic gates. The numbers belong to this small design and this tool.

Rule 4 at work: each register of the slice costs 17 flip-flops here, and the full slice costs 34. The full slice brings the longest path from 15 levels to 10.

The forward slice alone reached 9. So in this design the full slice buys no extra speed, and costs 17 more flip-flops. Its gain is of another kind: no path crosses it at all. The two sides can be timed, placed and changed without regard to each other.

These labs leave things out. The design has two hops, so there is one place to cut. Logic levels ignore wire length. A real timing report gives delays in time, as the hand example does.

Why It Is Built This Way

Design choiceThe alternativeWhat the choice buys, and costs
A full slice with two registersA half-rate slice with oneOne beat per cycle, so a burst keeps its speed. Twice the flip-flops.
A different number of slices in each channelThe same number in all channelsOnly the failing paths are cut, and only they pay latency. Each channel must be checked by itself.
No slice between processor and memorySlices on every port, for an easy layoutThe most frequent access stays as fast as it can be. That route must be kept short on the chip.

A half-rate slice is not a mistake in itself. A register bank that is written once per second loses nothing by it. The choice needs a number: how many beats per cycle must this channel carry?

The Trap: A Slice That Passes Every Test

Back to the team from the top of the page. Their tests sent one beat, checked it, and sent the next. A half-rate slice passes all of that. Every beat arrives once, in order.

The first four edges of the half-rate run.
e1 up: valid=1 data=a1 ready=1 | down: valid=0 data=xx ready=1 | handed over a1, taken --
e2 up: valid=1 data=a2 ready=0 | down: valid=1 data=a1 ready=1 | handed over --, taken a1
e3 up: valid=1 data=a2 ready=1 | down: valid=0 data=a1 ready=1 | handed over a2, taken --
e4 up: valid=1 data=a3 ready=0 | down: valid=1 data=a2 ready=1 | handed over --, taken a2

Look at the sender's ready: 1, 0, 1, 0. The slice refuses a beat in every second cycle. A burst of six beats takes twelve edges in place of seven.

No checker of the protocol objects, because waiting is legal. Only a measurement of throughput shows it. So test a slice with a sender that always has a beat and a receiver that is always ready. Then count the edges.

At Scale

This page1 path, 4 hops
A large interconnectthousands of paths

This section looks ahead. The hand example has one path and three places to cut. A chip has thousands of paths.

  1. A slice as a setting

    Interconnect blocks are often delivered with a setting for each port and channel: no slice, forward, backward or full. Choosing them is a task of timing closure.

  2. Latency is a budget

    Each slice adds to the wait of every manager that crosses it. The next lesson, on quality of service, turns such waits into limits.

  3. Where the delays come from

    The Static Timing track shows how a path is checked against the clock period, starting with Setup and Hold.

  4. Wide channels

    A read data channel of a large chip can be hundreds of bits wide. A full slice on it costs twice that in flip-flops, for each port.

Try It

Run the lab. Find the edge at which the slice holds two beats.

Set READY to all ones. Compare the last line with the table of three runs.

Change full_slice to half_slice in the line that places the piece. Count the edges for six beats.

With full_slice, make the receiver stop for three edges in a row. Say why two places are still enough.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: e1 up: valid=1 data=a1 ready=1 | down: valid=0 data=xx ready=1 | handed over a1, taken -- e2 up: valid=1 data=a2 ready=1 | down: valid=1 data=a1 ready=1 | handed over a2, taken a1 e3 up: valid=1 data=a3 ready=1 | down: valid=1 data=a2 ready=1 | handed over a3, taken a2 e4 up: valid=1 data=a4 ready=1 | down: valid=1 data=a3 ready=0 | handed over a4, taken -- e5 up: valid=1 data=a5 ready=0 | down: valid=1 data=a3 ready=1 | handed over --, taken a3 e6 up: valid=1 data=a5 ready=1 | down: valid=1 data=a4 ready=1 | handed over a5, taken a4 e7 up: valid=1 data=a6 ready=1 | down: valid=1 data=a5 ready=1 | handed over a6, taken a5 e8 up: valid=0 data=a7 ready=1 | down: valid=1 data=a6 ready=1 | handed over --, taken a6 e9 up: valid=0 data=a7 ready=1 | down: valid=0 data=a7 ready=1 | handed over --, taken -- e10 up: valid=0 data=a7 ready=1 | down: valid=0 data=a7 ready=1 | handed over --, taken -- handed over 6, taken 6: a1 a2 a3 a4 a5 a6 last beat taken at e8

Check Yourself

Predict the outputThe lab runs with the full slice and five beats. The receiver is not ready at e3 and at e6. What is the last line the lab prints?
// One channel with a full slice in the middle. Test code sends 5 beats and prints every edge.
// ---- Forward slice: flip-flops on valid and data. ready passes through as logic. ----
module fwd_slice (
  input  logic       clk, rst,
  input  logic       up_valid,  input  logic [7:0] up_data,  output logic up_ready,
  output logic       dn_valid,  output logic [7:0] dn_data,  input  logic dn_ready
);
  assign up_ready = !dn_valid || dn_ready;      // room when the register is empty, or is being emptied now
  always_ff @(posedge clk)
    if (rst) dn_valid <= 1'b0;
    else if (up_ready) begin
      dn_valid <= up_valid;
      dn_data  <= up_data;
    end
endmodule

// ---- Backward slice: ready comes from a flip-flop. One spare register catches the beat under way. ----
module bwd_slice (
  input  logic       clk, rst,
  input  logic       up_valid,  input  logic [7:0] up_data,  output logic up_ready,
  output logic       dn_valid,  output logic [7:0] dn_data,  input  logic dn_ready
);
  logic       spare_full;                       // 1: the spare register holds a beat
  logic [7:0] spare_data;
  assign up_ready = !spare_full;                // from a flip-flop alone: no logic from dn_ready
  assign dn_valid = spare_full || up_valid;     // valid and data pass through, the spare beat first
  assign dn_data  = spare_full ? spare_data : up_data;
  always_ff @(posedge clk)
    if (rst) spare_full <= 1'b0;
    else if (!spare_full) begin
      if (up_valid && !dn_ready) begin          // a beat was handed over, and the receiver did not take it
        spare_full <= 1'b1;
        spare_data <= up_data;
      end
    end
    else if (dn_ready) spare_full <= 1'b0;      // the spare beat has gone on
endmodule
// ---- Full slice: a backward slice, then a forward slice. No path crosses it as logic. ----
module full_slice (
  input  logic       clk, rst,
  input  logic       up_valid,  input  logic [7:0] up_data,  output logic up_ready,
  output logic       dn_valid,  output logic [7:0] dn_data,  input  logic dn_ready
);
  wire       mid_valid, mid_ready;
  wire [7:0] mid_data;
  bwd_slice back  (.clk, .rst, .up_valid, .up_data, .up_ready, .dn_valid(mid_valid), .dn_data(mid_data), .dn_ready(mid_ready));
  fwd_slice front (.clk, .rst, .up_valid(mid_valid), .up_data(mid_data), .up_ready(mid_ready), .dn_valid, .dn_data, .dn_ready);
endmodule
// ---- Half-rate slice: one register. It says "ready" only while the register is empty. ----
module half_slice (
  input  logic       clk, rst,
  input  logic       up_valid,  input  logic [7:0] up_data,  output logic up_ready,
  output logic       dn_valid,  output logic [7:0] dn_data,  input  logic dn_ready
);
  assign up_ready = !dn_valid;                  // from a flip-flop alone
  always_ff @(posedge clk)
    if (rst) dn_valid <= 1'b0;
    else if (!dn_valid) begin
      dn_valid <= up_valid;
      dn_data  <= up_data;
    end
    else if (dn_ready) dn_valid <= 1'b0;
endmodule

// ---- Test code: a sender, the piece in the middle, and a receiver that is not always ready ----
module tb;
  logic clk = 0, rst = 1;
  always #5 clk = ~clk;                          // "#5" waits 5 time units: one clock cycle is 10

  logic       up_valid, dn_ready = 0;
  logic [7:0] up_data;
  wire        up_ready, dn_valid;
  wire  [7:0] dn_data;
  full_slice piece (.*);                       // ".*" joins every port to the signal of the same name

  localparam int BEATS = 5;
  localparam logic [0:9] READY = 10'b1101101111;   // the receiver's ready at e1, e2, ...
  int sent = 0, taken = 0, n = 0, last = 0;
  string list = "", gave, took;
  assign up_valid = !rst && (sent < BEATS);      // the sender has a beat while any is left
  assign up_data  = 8'ha1 + sent[7:0];           // the beats are a1, a2, a3, ...

  always @(posedge clk) if (!rst) begin
    n++;
    gave = "--";  took = "--";
    if (up_valid && up_ready) begin              // a handshake on the sender's side
      gave = $sformatf("%h", up_data);
      sent <= sent + 1;
    end
    if (dn_valid && dn_ready) begin              // a handshake on the receiver's side
      took = $sformatf("%h", dn_data);
      list = {list, " ", took};
      taken++;  last = n;
    end
    $display("e%0d up: valid=%b data=%h ready=%b | down: valid=%b data=%h ready=%b | handed over %s, taken %s",
             n, up_valid, up_data, up_ready, dn_valid, dn_data, dn_ready, gave, took);
    dn_ready <= (n < 10) ? READY[n] : READY[9];
  end

  initial begin
    @(negedge clk);
    rst = 0;  dn_ready = READY[0];
    repeat (10) @(posedge clk);
    #1;
    $display("handed over %0d, taken %0d:%s", sent, taken, list);
    $display("last beat taken at e%0d", last);
    $finish;                                     // $finish ends the simulation
  end
endmodule
ConceptHow many beats can a full slice hold?
ConceptA read crosses two full slices on its address channel and one on its data channel. How many cycles do the slices add to the whole read?
ConceptA path has hops of 2, 5, 2 and 3 ns, and the period is 7 ns. Where does one cut make every segment fit?
ConceptWhich route should have no slice, if the layout allows it?

Common Mistakes

Wrong Cut both paths with one register that is ready only while empty.

It moves one beat in two cycles.

Fix Use a full slice with two places where throughput matters.

Wrong Count the latency of a slice once for a read.

The request and the reply use different channels, and each may be cut.

Fix Add the slices of both channels on the route.

Wrong Place the cut next to the block that the timing report names.

The other segment may still be too long.

Fix Choose the cut that makes the longest segment shortest.

Remember

  • A full slice is a backward slice followed by a forward slice. No signal crosses it as logic.
  • It holds two beats, and so it still moves one beat per cycle.
  • A half-rate slice has one register and moves one beat in two cycles.
  • Each slice adds one cycle per beat; a read pays on the request channel and on the reply channel.
  • Cut where the longest segment becomes shortest, and leave the fastest route uncut.

Practice

Report a problem with this page