题解 | #全加器#

全加器

https://www.nowcoder.com/practice/d04c046febb74e72949baee9aa99d958

`timescale 1ns/1ns

module add_half(
   input                A   ,
   input                B   ,
 
   output	wire        S   ,
   output   wire        C   
);

assign S = A ^ B;
assign C = A & B;
endmodule

/***************************************************************/
module add_full(
   input                A   ,
   input                B   ,
   input                Ci  , 

   output	wire        S   ,
   output   wire        Co   
);
   wire S_h;
   wire C_h,C2;

   add_half inst_half0(
    .A (A)  ,
    .B (B)  ,
    
    .S (S_h) ,
    .C (C_h)  
    );

    add_half inst_half1(
    .A (S_h)  ,
    .B (Ci)  ,
    
    .S (S) ,
    .C (C2)  
    );

    assign Co = C_h | C2;

endmodule

全部评论

相关推荐

哥_留个offer先:跟他说,你这个最好用c#,微软就用c#Java不适合这个项目
点赞 评论 收藏
分享
RickieOne:还有一个面试,上来就笔试算法 1️⃣ 字符串分割不能用 split ,ab&&c,根据&&放到数组上 2️⃣a 到 z 的全部组合情况,包括 a...z 3️⃣多线程,同时打印 1-200 4️⃣sql 代码 考分组 聚合 平均结合 小厂也这样吗,然后就八股 再拷打项目
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务