Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ATMEGA128A
- half adder
- KEYPAD
- uart 통신
- pwm
- vivado
- java
- prescaling
- stop watch
- DHT11
- i2c 통신
- BASYS3
- dataflow modeling
- Linked List
- hc-sr04
- LED
- Algorithm
- soc 설계
- D Flip Flop
- atmega 128a
- behavioral modeling
- gpio
- Recursion
- verilog
- Edge Detector
- test bench
- structural modeling
- ring counter
- FND
- Pspice
Archives
- Today
- Total
거북이처럼 천천히
Half adder 본문
1. Half adder
1.1. Behavioral Modeling (by using case)
<Source>
// Behavioral modeling of Half adder
module Half_adder_Behavioral_Modeling(
input a, b,
output reg carry, sum);
always @(a, b) begin
case({a, b})
2'b00 : begin carry = 0; sum = 0;end
2'b01 : begin carry = 0; sum = 1;end
2'b10 : begin carry = 0; sum = 1;end
2'b11 : begin carry = 1; sum = 0;end
endcase
end
endmodule
<Simulation>
<RTL Analysis>
<Synthesis>
1.2. Structural Modeling
<Source>
// Behavioral modeling of and gate.
module and_gate (
input a, b,
output reg out);
always @(a, b) begin
case({a, b})
2'b00 : out = 0;
2'b01 : out = 0;
2'b10 : out = 0;
2'b11 : out = 1;
endcase
end
endmodule
// Behavioral modeling of xor gate.
module xor_gate (
input a, b,
output reg out);
always @(a, b) begin
case({a, b})
2'b00 : out = 0;
2'b01 : out = 1;
2'b10 : out = 1;
2'b11 : out = 0;
endcase
end
endmodule
// Structural modeling of half adder
module Half_adder_Structural_Modeling(
input a, b,
output sum, carry);
and_gate and0 (a, b, carry);
xor_gate xor0 (a, b, sum);
endmodule
<Simulation>
<RTL Analysis>
<Synthesis>
1.3. Dataflow Modeling
<Source>
// Dataflow modeling of Half adder
module Half_adder_Dataflow_modeling(
input a, b,
output sum, carry);
wire [1:0] result = a + b;
assign sum = result[0];
assign carry = result[1];
endmodule
<Simulation>
<RTL Analysis>
<Synthesis>
'RTL Design > Verilog 연습' 카테고리의 다른 글
1 bit Comparator (0) | 2024.06.30 |
---|---|
4 bit parallel adder / subtractor (0) | 2024.06.30 |
4 bit parallel adder (0) | 2024.06.30 |
Full adder (0) | 2024.06.29 |
2024년 6월 12일 - Verilog Review (1) | 2024.06.13 |