Department of Computer Science and Technology

Course pages 2019–20

ECAD and Architecture Practical Classes

Tick 1

To achieve Tick 1 you need to:

  • Answer the following questions on screen or on paper, and show them to a demonstrator
  • Show a demonstrator your rotary encoder and division code on screen or on paper
  • Show a demonstrator your digital clock running in simulation

To achieve a starred Tick 1 you can also show a demonstrator your audio tone generator.


  1. The following SystemVerilog might not do what the designer intended. Identify some of the pitfalls they fell into:

    // a module containing two 8-bit counters
    // If latch is high, we store and output the two 8-bit counter values
    // If latch is not high, the two outputs swap on each clock cycle
    module alternating_counters(
      input clock,
      input reset,
      input latch,
      output logic out_a,
      output logic out_b
      logic [7:0] count_a;
      logic [7:0] count_b;
      initial begin
        count_a <= 8'h0;
        count_b <= 8'h80;
      always @(clock) begin
        count_a <= count_a - 1;
        count_b <= count_b + 1;
        out_b = latch ? count_b : out_a;
        out_a = latch ? count_a : out_b;  
    (if you get stuck, try it in ModelSim)
  2. The clock crystal on the DE1-SoC is 50MHz. Consider if this was replaced with a 500MHz crystal. Would your design still work? Making reference to the output of your Quartus compilation, explain why this would be the case. (It may help if you draw a timing diagram showing how data moves from one flipflop to the next, considering timing requirements of combinational logic and flipflops).

  3. How efficient is your division routine? Derive an expression for the number of cycles it takes based on the number of bits in a0 and a1. It doesn't matter if your expression is inexact. (Hint: using your simulation first measure the baseline, the smallest number of cycles it takes for example when a0=0. Then add in other term(s))


You will need to hand in your results as part of your Portfolio of Assessed Laboratory work in Lent term, so keep them safe. You should hand in:

  • Your answers to the questions
  • A printout of the rotary encoder code you wrote
  • A printout of your division assembler

On each document you should add a header:

Name of practical class and tick: ECAD+Arch tick 1
Full name: