Showing posts with label pipelining. Show all posts
Showing posts with label pipelining. Show all posts

Monday, April 3, 2023

 This is a simple microarchitecture problem. You are asked to design a data splitter. It accepts 700-bit-wide data and outputs 1 or more chunks. In the worst case, it should spit out 4 data chunks.


The diagram below shows slightly more details. You need to create a struct to make sure you understand the problem correctly. The incoming data contains 32 chunks of 20-bit data (pointers??). One field in the header indicates the number of data chunks. It decides whether to output just one chunk of data or multiple chunks. The diagram shows the worst-case scenario when num_data=32. Each chunk can carry 8 pieces of data, so you will end up transmitting 4 chunks of data over 4 clocks.

Some fields in the header also indicate the destination. They will be used to decide where to send the data: Data_Out_0 or Data_Out_1.

With this information, create a microarchitecture.



Issue 1: As you are creating 4 clocks' worth of output transactions with 1 clock of input data, you will have a backpressure issue. How will you solve it? Where will you put your FIFOs?

Issue 2: When this splitter is transmitting data on one output port, the other output port is unused for 4 or more clocks. How do you modify the design so that both output ports stay busy?

Imagine a worst-case scenario in which inputs arrive in such a way that their output ports alternate. You can see that if one output port back pressures, the second port stalls or starves, even if it is not congested. How to avoid this head-of-the-line blocking? 

Tuesday, September 15, 2020

Interview Question 46: What is wrong with this design?

 Study the provided block diagram of a chip-level design. Each square has one clock delay associated with it. What can go wrong with this type of design? How will you fix it? How it will affect the overall design?






Monday, July 6, 2020

Interview Question 44: Fix the Timing Issue

Consider a design where two modules on the chip communicate with each other over a bus using a protocol like AXI. Data from block 1 is consumed by block 2 when both valid and ready are asserted.

The timing shown below shows how this protocol works.

After Synthesis and Place & Route, you find out that a valid/ready handshake is not meeting timing. How will you fix it?

These two blocks are IPs from a vendor. Though you have access to RTL, you can not change them radically. You are allowed to add some glue logic in between. This is a fairly open-ended question. Your past experience will result in multiple ideas.

How will you attach this problem in these two scenarios?
a) Timing violation is just 5-10% of the clock period.
b) Timing violation is 50-60% of the clock period.

The above two scenarios need different approaches. 
Hint: How will you fix if you are supposed to make change during one of these stages/phases of design
- Micro-Architecture
- RTL Design 
- Synthesis
- Place and Route
- ECO

Saturday, June 6, 2020

Interview Question 43: Improve the data pipeline

 This is a data pipeline question. The existing design has a simple data pipeline as shown below.


Data_in is a wide bus that comes along with a qualifier valid_in every clock. The pipeline stage which is shown as a box is straightforward and just passes data and a valid bit to the next stage. In the above picture, the blue boxes are ones that have data and valid=1. The read ones are just passing valid=0 with old data.

When the pause is asserted by the block on the right side which is receiving this data, the whole pipeline freezes. You can see that only two out of six stages contain real data. The Pause is passed as it is to the left side which stops providing data.

Your job is to fix these pipeline stages or even re-write them so that when the pause is asserted the design continues to absorb data from the left side till all pipe stages are full and then assert the back_pressure signal. In the above example, this will happen after 3 clocks.


Wednesday, May 20, 2020

Interview Question 42: Design Moving Average Calculator






Moving average = Sum of (number_in_1 + ...................+ number_in_N) / N

Assume that you need to calculate the moving average over 256 last numbers.

Followup questions: 

- Design a parameterized RTL which can be used for any number

- What is the width of incoming numbers? (parameterized)

- Is there any restriction on the size of the design?

    . How restriction on size will change design and accuracy?



Friday, April 3, 2020

Interview Question 41: Design a circuit to calculate square of a number

Create micro-architecture and write an RTL code for a design that calculates the square of a given number.

Caveat: It should not use any multiplier operation. It does not have to be done in one clock cycle.


Wednesday, February 12, 2020

Interview Question 39: Compute Sum of Differences.

 You need to compute the Sum of Differences for the given two matrices.

Output = ABS(A00-B00) + .... + ABS(A03-B03) + ........+ ABS(A30-B30) + .... + ABS(A33-B33)

Each entry is an 8-bit unsigned integer. 

Questions you should be asking:
- Are all the values are available immediately or they arrive at different times?
- How many clocks are allowed to compute? (1/2/4/16)
    . The answer will change your micro-architecture of design

Hints:
- Design a simple SOD design for just two 8-bit inputs. This can become a building block.
- Give attention to the widths of outputs of each block.
- What will change if the design can not fit in the required number of clocks? (pipelining)