Last active
January 10, 2017 02:17
-
-
Save rikitoro/1c9627c911609c1e2c7877be4d4c98a9 to your computer and use it in GitHub Desktop.
Verilog HDLでのノンブロッキング代入とブロッキング代入の動作の違い (授業用) ref: http://qiita.com/rikitoro@github/items/7a2ee703182c3abd9f83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`default_nettype none | |
module dflipflop( | |
input wire clock, | |
input wire data, | |
output reg [3:0] q | |
); | |
always @ (posedge clock) begin | |
q[0] = data; // ブロッキング代入 = では | |
q[1] = q[0]; // 上から下へ順に代入が | |
q[2] = q[1]; // 行われるような | |
q[3] = q[2]; // 回路が構築される | |
end | |
endmodule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`default_nettype none | |
module shiftregister( | |
input wire clock, | |
input wire data, | |
output reg [3:0] q | |
); | |
always @ (posedge clock) begin | |
q[0] <= data; // ノンブロッキング代入 <= では | |
q[1] <= q[0]; // これら4つの代入が | |
q[2] <= q[1]; // 同時に実行されるような | |
q[3] <= q[2]; // 回路が構築される | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment