mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-27 02:45:52 +00:00
initial import
This commit is contained in:
commit
7764d0ba1d
481 changed files with 54634 additions and 0 deletions
35
tests/asicworld/code_verilog_tutorial_explicit.v
Normal file
35
tests/asicworld/code_verilog_tutorial_explicit.v
Normal file
|
@ -0,0 +1,35 @@
|
|||
module explicit();
|
||||
reg clk,d,rst,pre;
|
||||
wire q;
|
||||
|
||||
// Here q_bar is not connected
|
||||
// We can connect ports in any order
|
||||
dff u0 (
|
||||
.q (q),
|
||||
.d (d),
|
||||
.clk (clk),
|
||||
.q_bar (),
|
||||
.rst (rst),
|
||||
.pre (pre)
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
// D fli-flop
|
||||
module dff (q, q_bar, clk, d, rst, pre);
|
||||
input clk, d, rst, pre;
|
||||
output q, q_bar;
|
||||
reg q;
|
||||
|
||||
assign q_bar = ~q;
|
||||
|
||||
always @ (posedge clk)
|
||||
if (rst == 1'b1) begin
|
||||
q <= 0;
|
||||
end else if (pre == 1'b1) begin
|
||||
q <= 1;
|
||||
end else begin
|
||||
q <= d;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue