0
0
Verilogprogramming~20 mins

Synchronous vs asynchronous read in Verilog - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of Synchronous vs Asynchronous Read
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of synchronous read in a RAM module

Consider the following Verilog code for a synchronous RAM read. What is the output value of data_out after the rising edge of clk when addr is 2?

Verilog
module sync_ram(input clk, input [1:0] addr, output reg [7:0] data_out);
  reg [7:0] mem [0:3];
  initial begin
    mem[0] = 8'hAA;
    mem[1] = 8'hBB;
    mem[2] = 8'hCC;
    mem[3] = 8'hDD;
  end
  always @(posedge clk) begin
    data_out <= mem[addr];
  end
endmodule
Adata_out = 8'hBB after the next rising edge of clk
Bdata_out = 8'hCC immediately at addr change
Cdata_out = 8'hCC after the next rising edge of clk
Ddata_out = 8'hDD immediately at addr change
Attempts:
2 left
💡 Hint

Think about when the data is updated in synchronous logic.

Predict Output
intermediate
2:00remaining
Output behavior of asynchronous read in a RAM module

Given the following Verilog code for an asynchronous RAM read, what is the value of data_out when addr changes to 3?

Verilog
module async_ram(input [1:0] addr, output [7:0] data_out);
  reg [7:0] mem [0:3];
  initial begin
    mem[0] = 8'h11;
    mem[1] = 8'h22;
    mem[2] = 8'h33;
    mem[3] = 8'h44;
  end
  assign data_out = mem[addr];
endmodule
Adata_out = 8'h44 immediately when addr changes
Bdata_out = 8'h33 after a clock edge
Cdata_out = 8'h22 after a clock edge
Ddata_out does not change until next clock edge
Attempts:
2 left
💡 Hint

Asynchronous read means output changes immediately with address.

🧠 Conceptual
advanced
2:00remaining
Difference in timing between synchronous and asynchronous read

Which statement correctly describes the timing difference between synchronous and asynchronous RAM reads?

ASynchronous read updates output immediately when address changes; asynchronous read waits for clock edge
BSynchronous read updates output only on clock edge; asynchronous read updates output immediately when address changes
CBoth synchronous and asynchronous reads update output only on clock edges
DBoth synchronous and asynchronous reads update output immediately when address changes
Attempts:
2 left
💡 Hint

Think about when the output changes relative to the clock and address.

Predict Output
advanced
2:00remaining
Error type in mixed synchronous and asynchronous read code

What error will this Verilog code produce?

module mixed_ram(input clk, input [1:0] addr, output reg [7:0] data_out);
  reg [7:0] mem [0:3];
  initial begin
    mem[0] = 8'h01;
    mem[1] = 8'h02;
    mem[2] = 8'h03;
    mem[3] = 8'h04;
  end
  always @(posedge clk) begin
    data_out <= mem[addr];
  end
  assign data_out = mem[addr];
endmodule
AWarning: unused variable mem
BNo error, code runs correctly
CRuntime error: conflicting assignments
DSyntaxError: multiple drivers for data_out
Attempts:
2 left
💡 Hint

Check how data_out is assigned in both procedural and continuous assignments.

🧠 Conceptual
expert
3:00remaining
Choosing read type for low-latency memory access

You need to design a memory module for a system that requires the fastest possible read access without waiting for a clock edge. Which read type should you choose and why?

AAsynchronous read, because it provides immediate data output on address change
BSynchronous read, because it ensures data stability on clock edges
CSynchronous read, because it avoids glitches on output
DAsynchronous read, because it synchronizes data with the clock
Attempts:
2 left
💡 Hint

Consider which read type updates output fastest after address changes.