Design a HLSM that computes the average temperature once eve
Design a HLSM that computes the average temperature once every minute. The temperature sensor sends out the temperature once every second. Show the data path and state machine.
Design a HLSM that computes the average temperature once every minute. The temperature sensor sends out the temperature once every second. Show the data path and state machine.
Solution
inputs:byte a, byte b, bit go
outputs:byte gcd, bit done
gcd:
while(1) {
while(!go);
done = 0;
while (a!=b) {
if(a>b) {
a=a-b;
}
else {
b=b-a;
}
gcd = a;
done = 1;
}
Outputs a warning when average temp over the past 4 samples exceeds a user defined value; clr disables the system • Inputs (32 bit): CT – current temp; WT – warning temp • Output : W – high if hot temperature; stays on until clr pressed again
