2228 views|4 replies

661

Posts

0

Resources
The OP
 

Behavioral modeling sequential logic circuit (two-input AND gate) source code and test code [Copy link]

Source code:
module and_gate1(clk, a, b, s);

input clk;
input a;
input b;

output reg s;

//Behavioral modeling sequential logic circuit (two-input AND gate)
always @ (posedge clk) //Rising edge triggered
begin
s <= a & b;
end
endmodule

test code:
`timescale 1ns/1ps
module and_gate1_tb;

reg clk;
reg a;
reg b;

wire s;

and_gate1 and_gate1a(
.clk(clk),
.a(a),
.b(b),
.s(s)
);


initial
begin
clk = 0;
a = 0; b = 0;
#100 a = 0; b = 1;
#100 a = 1; b = 0;
#100 a = 1; b = 1;
#100 $stop;
end

always #10 clk = ~clk;
endmodule
This post is from FPGA/CPLD

Latest reply

Thanks for sharing, I learned a lot   Details Published on 2020-3-16 13:26
 

661

Posts

0

Resources
2
 

Behavioral modeling sequential logic circuit (two-input AND gate) source code and test code

This post is from FPGA/CPLD
 
 

661

Posts

0

Resources
3
 

Behavioral modeling sequential logic circuit (two-input AND gate) source code and test code

This post is from FPGA/CPLD
 
 
 

661

Posts

0

Resources
4
 

Behavioral modeling sequential logic circuit (two-input AND gate) source code and test code

This post is from FPGA/CPLD
 
 
 

174

Posts

0

Resources
5
 

Thanks for sharing, I learned a lot

This post is from FPGA/CPLD
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list