ticktock

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ticktock

Koen_Be3840
In the mult.tst

repeat 50 {
  ticktock;
}

Do we always know how many steps it takes to compute a task? Or do we have to guess?
 
Reply | Threaded
Open this post in threaded view
|

Re: ticktock

ybakos
Short answer: you can ignore the predetermined clock cycles in the test scripts.


It really depends at what level of abstraction you're thinking. But in general, no, since inputs for a task can vary, we know not how many cycles it may take to complete an operation.

However, those predetermined clock cycles are such that there is plenty of "headroom" to accomplish the expected task. It is certainly possible to write an implementation that uses superfluous instructions, accomplishes the multiplication, yet fails the test due to not reaching the "answer" before 50 cycles.

Reply | Threaded
Open this post in threaded view
|

Re: ticktock

cadet1620
Administrator
In reply to this post by Koen_Be3840
Koen_Be3840 wrote
In the mult.tst

repeat 50 {
  ticktock;
}

Do we always know how many steps it takes to compute a task? Or do we have to guess?
The number of ticks in the test scripts is generally enough to complete the program tests as described in the project.

In the case of Mult.asm, the task is described as computing multiplication using repeated addition. I wrote a general 16 by 16 multiply routine and it was failing because it took more than 50 ticks to run. So I upped the number a bit and the test was happy.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: ticktock

Eugeniu
I think setting the number of ticktocks to be different depending on the values in R0, R1  is conceptually wrong because it assumes a specific implementation (the naive representation of multiplication as addition I guess). Although guessing which students will do which implementations is also impossible as well. Probably it is worth mentioning in the book that the number of ticktocks should be adjusted depending on implementation.