베릴로그,Verilog

Difference between r1.1 and the current

@@ -1,6 +1,111 @@
[[모듈,module]]
#noindex
##====베릴로그,Verilog =,Verilog 베릴로그 Verilog
Terms
module [[모듈,module]]
a block of code that performs specific function
port
input port
output port
module 선언 시 처음에 input/outport port list 나열.
 
 
MKL
HDL [[하드웨어기술언어,hardware_description_language,HDL]]
EDA electronic design automation 전자설계자동화 ? Ggl:"electronic design automation"
[[digital_design]]
[[회로,circuit]]
[[시뮬레이션,simulation]]

----
[[하드웨어기술언어,hardware_description_language,HDL]]
[[VG:베릴로그,Verilog]]
YouTube:"Verilog 강의"
 
 
https://ko.wikipedia.org/wiki/베릴로그
 
https://en.wikipedia.org/wiki/Verilog
 
----
excerpts from Mano
 
E=(A+B)C
{{{
module or_and( output E, input A, B, C );
wire D;
assign D = A || B; // logical or
assign E = C && D; // logical and
endmodule
}}}
 
----
[[멀티플렉서,multiplexer]] example from https://youtu.be/9SbI38MMN7Y?t=2267 - see there for diagram
{{{
module multiplexer (D0, D1, S, Z);
output Z;
input D0, D1, S; // S는 화면에 빠졌는데 있어야 함
wire temp0, temp1;
 
not (Sbar, S);
and (temp0, DO, Sbar);
and (temp1, D1, S);
or (Z, temp0, temp1);
endmodule
}}}
 
----
ex. from https://www.youtube.com/watch?v=2IReMT_zjK8
2-to-1 [[멀티플렉서,multiplexer]]
https://i.imgur.com/Z9qpWjL.png
https://i.imgur.com/0KqnQ4d.png
gate level
{{{
module multiplex_gatelevel(A,B,X,out1);
input A, B, X;
output out1;
wire not_x;
wire out_and1, out_and2;
not not1(not_X, X);
and and1(out_and1, not_X, A);
and and2(out_and2, X, B);
or or1(out1, out_and1, out_and2);
endmodule
}}}
dataflow level
{{{
module multiplex_datalevel(A,B,X,out1);
input A, B, X;
output out1;
assign out1 = ((~X&A)&A)|(B&X);
endmodule
}}}
behavioral level
{{{
module multiplex_behavior(A,B,X,out1);
input A, B, X;
output reg out1;
always@(*)
begin
if(X==0)
out1 = A;
else
out1 = B;
end
endmodule
}}}
----
half_adder example from https://youtu.be/IREjtgG33hQ?t=131
{{{
module HalfAdd_Behave2 (a,b,c,s);
input a,b;
output c;
output reg s; // <- output from always block goes to registers
always // procedural statements must be inside 'always' block
@(a,b) // @(...) : sensitivity list
// 'always @(a,b)' means the always block is executed whenever a or b (or both) changes. always @(*) 또는 @*로 쓰고 컴파일러가 알아서 어떤 신호를 고려하게 할 지 하는 것도 가능.
if (a != b)
s = 1;
else
s = 0;
assign c = a&b; // <- output of continuous assignment goes to net
endmodule // HalfAdd_Behave2
}}}



Terms
module 모듈,module
a block of code that performs specific function
port
input port
output port
module 선언 시 처음에 input/outport port list 나열.


MKL
HDL 하드웨어기술언어,hardware_description_language,HDL
EDA electronic design automation 전자설계자동화 ? Ggl:electronic design automation
digital_design
회로,circuit
시뮬레이션,simulation







excerpts from Mano

E=(A+B)C
module or_and( output E, input A, B, C );
wire D;
assign D = A || B; // logical or
assign E = C && D; // logical and
endmodule


멀티플렉서,multiplexer example from https://youtu.be/9SbI38MMN7Y?t=2267 - see there for diagram
module multiplexer (D0, D1, S, Z);
output Z;
input D0, D1, S; // S는 화면에 빠졌는데 있어야 함
wire temp0, temp1;

not (Sbar, S);
and (temp0, DO, Sbar);
and (temp1, D1, S);
or (Z, temp0, temp1);
endmodule


ex. from https://www.youtube.com/watch?v=2IReMT_zjK8
2-to-1 멀티플렉서,multiplexer
https://i.imgur.com/Z9qpWjL.png

https://i.imgur.com/0KqnQ4d.png

gate level
module multiplex_gatelevel(A,B,X,out1);
input A, B, X;
output out1;
wire not_x;
wire out_and1, out_and2;
not not1(not_X, X);
and and1(out_and1, not_X, A);
and and2(out_and2, X, B);
or or1(out1, out_and1, out_and2);
endmodule
dataflow level
module multiplex_datalevel(A,B,X,out1);
input A, B, X;
output out1;
assign out1 = ((~X&A)&A)|(B&X);
endmodule
behavioral level
module multiplex_behavior(A,B,X,out1);
input A, B, X;
output reg out1;
always@(*)
begin
if(X==0)
out1 = A;
else
out1 = B;
end
endmodule

half_adder example from https://youtu.be/IREjtgG33hQ?t=131
module HalfAdd_Behave2 (a,b,c,s);
input a,b;
output c;
output reg s; // <- output from always block goes to registers
always //  procedural statements must be inside 'always' block
@(a,b) // @(...) : sensitivity list
// 'always @(a,b)' means the always block is executed whenever a or b (or both) changes. always @(*) 또는 @*로 쓰고 컴파일러가 알아서 어떤 신호를 고려하게 할 지 하는 것도 가능.
 if (a != b)
  s = 1;
 else
  s = 0;
 assign c = a&b; // <- output of continuous assignment goes to net
endmodule // HalfAdd_Behave2