Skip to Content
Digital Design and Computer Architecture, ARM Edition
book

Digital Design and Computer Architecture, ARM Edition

by Sarah Harris, David Harris
April 2015
Intermediate to advanced
584 pages
21h 24m
English
Morgan Kaufmann
Content preview from Digital Design and Computer Architecture, ARM Edition
image
Figure 4.17 Synchronizer circuit

HDL Example 4.20

Synchronizer

SystemVerilog

module sync(input  logic  clk,

       input  logic  d,

       output logic q);
 logic n1;
 always_ff @(posedge clk)
   begin
   n1 <= d; // nonblocking
   q <= n1; // nonblocking
   end
endmodule

Notice that the begin/end construct is necessary because multiple statements appear in the always statement. This is analogous to {} in C or Java. The begin/end was not needed in the flopr example because if/else counts as a single statement.

VHDL

library IEEE; use IEEE.STD_LOGIC_1164.all;
entity sync is
 port(clk: in STD_LOGIC;
    d:  in STD_LOGIC;
    q:  out STD_LOGIC);
end;
architecture ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Digital Design and Computer Architecture, 2nd Edition

Digital Design and Computer Architecture, 2nd Edition

David Harris, Sarah Harris
Computer Architecture, 5th Edition

Computer Architecture, 5th Edition

John L. Hennessy, David A. Patterson

Publisher Resources

ISBN: 9780128009116