Design an Efficient System for Calculating Average of Recent Data Inputs

  • Thread starter perplexabot
  • Start date
  • Tags
    Data Input
In summary, the conversation is about designing a system that outputs the average of the most recent two data input samples using the RTL design process. The system has an 8-bit unsigned data input and output, and the data input is sampled on the 0 --> 1 transition of a single-bit input. The conversation discusses the timing of the data input, the use of registers, and the computation needed to take the average. It concludes with the suggestion of using three registers and the question of whether the output register clock should be twice the period of the input.
  • #1
perplexabot
Gold Member
329
5
Hi all.

The question says:

Use the RTL design process to design a system that outputs the average of the most recent two data input samples. The system has an 8-bit unsigned data input I, and an 8-bit unsigned output avg. The data input is sampled when a single-bit input S changes from 0 to 1. Choose internal bitwidths that prevent overflow.

I have two questions. Firstly, is the data input sent following a clock cycle? If not, how do you know when a new datum is sent?

Secondly, how can you tell if the first two bytes are the same byte or different bytes but with equivalent values?

Thank you
 
Physics news on Phys.org
  • #2
perplexabot said:
Hi all.

The question says:

Use the RTL design process to design a system that outputs the average of the most recent two data input samples. The system has an 8-bit unsigned data input I, and an 8-bit unsigned output avg. The data input is sampled when a single-bit input S changes from 0 to 1. Choose internal bitwidths that prevent overflow.

I have two questions. Firstly, is the data input sent following a clock cycle? If not, how do you know when a new datum is sent?

Secondly, how can you tell if the first two bytes are the same byte or different bytes but with equivalent values?

Thank you

It sounds like the data changes on the 1 --> 0 transition of the sample clock "S", and you should clock the data into your input register on the 0 --> 1 edge.

For each 0 --> 1 clock edge, you will clock in the new byte and clock the previous new byte into another register. Then what do you have to do with those two registers to take the average?
 
  • #3
Oh I see. So the data input is implicitly half a cycle out phase with the register clocks (do I have the idea right?). I was actually thinking about using a clock divider, but I guess not any more.

And to answer your question, to take the average you would use an adder then a bit shifter (right shifter), am I right?

The computation is not my problem, it is how to store the first two bytes that is the problem for me. I'm going to give it another try with your comment in mind. Thanks for the reply.
 
  • #4
perplexabot said:
Oh I see. So the data input is implicitly half a cycle out phase with the register clocks (do I have the idea right?).
Yep. That's a pretty typical way that you manage your clocked systems.

perplexabot said:
And to answer your question, to take the average you would use an adder then a bit shifter (right shifter), am I right?
Yep again! :smile:
 
  • #5
Wow, that's great. Another question if you don't mind me asking.

For each 0 --> 1 clock edge, you will clock in the new byte and clock the previous new byte into another register.

I am assuming you are implying to use two registers. But can this not be done with only one register (the other "register" would be the data from the data line)?
 
  • #6
perplexabot said:
Wow, that's great. Another question if you don't mind me asking.



I am assuming you are implying to use two registers. But can this not be done with only one register (the other "register" would be the data from the data line)?

The traditional synchronous way to do this would have 3 clocked 8-bit registers. The input register, the intermediate register, and the output register. What configuration are you thinking about exactly? And can you see some limitations with using less than 3 8-bit registers?
 
  • #7
I was thinking (a rough algorithm):
clock the first data (rising edge) into input register
clock every other data (rising edge) into input register
when not clocking data into register on rising edge : use current data in dataline and register to compute.

I have not heard of the traditional method that you have mentioned, and no i can not see the limitations of using less than 3 registers.

PS: sorry for the misplaced thread
 
  • #8
perplexabot said:
I was thinking (a rough algorithm):
clock the first data (rising edge) into input register
clock every other data (rising edge) into input register
when not clocking data into register on rising edge : use current data in dataline and register to compute.

Well, if you had a lot more information about the timing of the input data stream, you might be able to make something work using both edges of the clock (if the data changed right after the 0 --> 1 clock edge, and was stable soon enough to meet the setup time requirements for the logic being clocked on the 1 --> 0 edge. But that's not usually how synchronous systems work. Generally only one clock edge is used as the "clock" to latch things into registers and flip-flops.
 
  • #9
I am not using both edges. I am using only the rising edges.
 
  • #10
perplexabot said:
I am not using both edges. I am using only the rising edges.

But how are you going to "use current data in dataline" as part of the computation when it is changing between rising clock edges...? :smile:
 
  • #11
Wow again, now I get what you meant by
Well, if you had a lot more information about the timing of the input data stream
. Ok so theoretically speaking, if the data in the dataline was stable at the moment when a computation called for it, then it would work. Is this correct? But, yes obviously this is very tedious, so I must change my approach.
 
  • #12
perplexabot said:
Wow again, now I get what you meant by . Ok so theoretically speaking, if the data in the dataline was stable at the moment when a computation called for it, then it would work. Is this correct? But, yes obviously this is very tedious, so I must change my approach.

Sounds like you get it. Good job!
 
  • #13
Thank you for your time.
 
  • #14
I have used 3 registers as you have mentioned. My output register contains the final computation (which I am using to send to a display). Should the period of the output register clock be twice as "S" since you need to go through two cycles of "S" to get a final output?
 
  • #15
perplexabot said:
I have used 3 registers as you have mentioned. My output register contains the final computation (which I am using to send to a display). Should the period of the output register clock be twice as "S" since you need to go through two cycles of "S" to get a final output?

It takes two clock cycles to load the queue. After that, each clock does what the problem statement asks for. You should probably state that in your homework submission.

For extra credit (at the PF if not in your class), how do the setup and hold time specs relate to the maximum clock frequency of your solution?
 
  • #16
Just out of curiosity, do students like you in the hyper-modern era cite Internet forum help threads as part of your online solutions?

EDIT -- Not being judgemental, just curious...
 
  • #17
Sorry for the late reply, was taking a study break.

It takes two clock cycles to load the queue. After that, each clock does what the problem statement asks for. You should probably state that in your homework submission.
- I still don't understand how the final register's clock relates to S. I am NOT asking for answers, I am asking for help.

For extra credit (at the PF if not in your class), how do the setup and hold time specs relate to the maximum clock frequency of your solution?
- I don't understand your question (Oops! :confused:). Specifically, what do you mean by "setup and hold time."

Just out of curiosity, do students like you in the hyper-modern era cite Internet forum help threads as part of your online solutions?
- I haven't thought of citing (and I haven't done so before). However, I would not mind doing so. As a matter of fact, I will do so for this homework (since you have helped extensively). I would like to let you know however, I highly doubt this homework is checked. Unfortunately we never get our homework back and I never know whether my design is correct. That is why I am here double checking if I am understanding the concepts. I have a bad professor (good person, bad teacher).
 
  • #18
All good responses.

Please google setup and hold times.

And please post a sketch of your solution so far. I think you are very close to the solution.
 
  • #19
Here is my current work. Sorry about the bad quality but that is all I have. In the mean time I will google set up time and hold time. I think I have to get rid of the last register (output register). For the datapath image the boxes that are NOT the shifter and adder are registers.
 

Attachments

  • datapath.jpg
    datapath.jpg
    29.7 KB · Views: 546
  • control.jpg
    control.jpg
    31.3 KB · Views: 497
  • #20
After some reading and researching I think I got the answer to :
how do the setup and hold time specs relate to the maximum clock frequency of your solution?

The setup time should be enough for the byte to travel to the gates of the register (or the register to read the data) and the hold time should be enough for the data to be stable and pass through the register (or the register to act upon data).

I am embarrassed I did not know what hold time and setup time meant.
 

FAQ: Design an Efficient System for Calculating Average of Recent Data Inputs

What is the purpose of designing an efficient system for calculating the average of recent data inputs?

The purpose of designing an efficient system for calculating the average of recent data inputs is to streamline the process of obtaining an accurate and up-to-date average. This can save time and resources, especially when dealing with large amounts of data.

How can an efficient system help with calculating the average of recent data inputs?

An efficient system can help by automating the process and utilizing algorithms to quickly and accurately calculate the average of recent data inputs. This can eliminate potential errors and reduce the time and effort required for manual calculations.

3. What factors should be considered when designing an efficient system for calculating the average of recent data inputs?

Some factors to consider include the size and complexity of the data set, the frequency of data inputs, and the desired level of accuracy. It is also important to consider the hardware and software resources available for the system.

4. What are some potential challenges of designing an efficient system for calculating the average of recent data inputs?

Some potential challenges include finding the most suitable algorithm for the specific data set, optimizing the system for speed and accuracy, and ensuring the system can handle a large volume of data inputs without crashing or slowing down.

5. How can the efficiency of the system be measured and improved?

The efficiency of the system can be measured by tracking the time and resources required to calculate the average of recent data inputs. To improve efficiency, the system can be continuously monitored and updated, and potential bottlenecks or inefficiencies can be identified and addressed.

Back
Top