-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
HA.v
47 lines (39 loc) · 972 Bytes
/
HA.v
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Akilesh Kannan <[email protected]>
//
// File: HA.v
// Modified: 2020-07-16
// Description: 1-Bit Half Adder Module
//
//
// License: MIT
//
////////////////////////////////////////////////////////////////////////
`default_nettype None
`timescale 1ns/1ps
primitive outSum(output sum, input A, input B);
// Truth Table for sum
table
// A B sum
0 0 : 0 ;
0 1 : 1 ;
1 0 : 1 ;
1 1 : 0 ;
endtable
endprimitive
primitive outCarry(output carry, input A, input B);
// Truth Table for carry out
table
// A B carry
0 0 : 0 ;
0 1 : 0 ;
1 0 : 0 ;
1 1 : 1 ;
endtable
endprimitive
module HA (output carry, output sum, input A, input B);
// instantiating sum and carry primitives
outSum s(sum, A, B);
outCarry c(carry, A, B);
endmodule