当前位置:首页 > 基于Libero的数字逻辑设计仿真及验证实验报告
2、组合逻辑电路 一、实验目的
1、了解基于Verilog的组合逻辑电路的设计及其验证。 2、熟悉利用EDA工具进行设计及仿真的流程。
3、学习针对实际组合逻辑电路芯片74HC148、74HC138、74HC153、74HC85、74HC283、74HC4511进行VerilogHDL设计的方法。
二、实验环境
Libero仿真软件。
三、实验内容
1、掌握Libero软件的使用方法。
2、进行针对74系列基本组合逻辑电路的设计,并完成相应的仿真实验。 3、参考教材中相应章节的设计代码、测试平台代码(可自行编程),完成74HC148、74HC138、74HC153、74HC85、74HC283、74HC4511相应的设计、综合及仿真。
4、74HC85测试平台的测试数据要求:进行比较的A、B两数,分别为本人学号的末两位,如“89”,则A数为“1000”,B数为“1001”。若两数相等,需考虑级联输入(级联输入的各种取值情况均需包括);若两数不等,则需增加一对取值情况,验证A、B相等时的比较结果。
5、74HC4511设计成扩展型的,即能显示数字0~9、字母a~f。
6、提交针对74HC148、74HC138、74HC153、74HC85、74HC283、74HC4511(任.选一个)的综合结果,以及相应的仿真结果。 ...
四、实验结果和数据处理
1、所有模块及测试平台代码清单
//74HC148代码
// 74HC148.v
module HC148(EI, In, Out, EO, GS); input EI; input [7:0]In; output [2:0]Out; output EO, GS; reg [2:0]Out; reg EO, GS; interger I;
8
always @(EI or In) if(EI) begin Out = 3'b111; EO = 1; GS = 1; end else
if( In == 8'b11111111 ) begin Out = 3'b111; EO = 0; GS = 1; end else begin for(I = 0;I < 8; I = I + 1) begin if( ~In[I]) begin Out = ~I; EO = 1; GS = 0; end end end
endmodule
//74HC148测试平台代码 // test_148.v
`timescale 1ns/1ns module test_148; reg ei;
reg [7:0]turn;
wire [7:0]in = ~turn; wire [2:0]out; wire eo,gs;
HC148 u(ei, in, out, eo, gs); initial begin
ei = 1;turn = 8'b1; repeat(8)
#10 turn = turn<<1; ei = 0;turn = 8'b1; repeat(8)
#10 turn = turn<<1;
end
endmodule
9
//74HC138代码 // 74HC138.v
module decoder3_8_1(DataIn,Enable,Eq); input [2:0] DataIn; input Enable; output [7:0] Eq; reg [7:0] Eq; wire[2:0] DataIn; integer I;
always @ (DataIn or Enable) begin if(Enable) Eq=0; else
for(I=0;I<=7;I=I+1) if(DataIn==I) Eq[I]=1; else
Eq[I]=0; end
endmodule
//74HC138测试平台代码 // test_138.v
`timescale 1ns/1ns module test_138; wire [2:0] out; reg [7:0] in; reg [2:0] ei;
HC138 u(out, in, ei);
task circle; begin
in = 0; repeat(8)
#10 in = in + 1;
end endtask
initial
10
begin ei = 1;circle(); ei = 0;circle(); ei = 2; repeat(6) begin
circle();
#10 ei = ei + 1; end end
endmodule
//74HC153代码 // 74HC153.v
module HC153(DateOut, DateIn, Sel, Enable); input [3:0]DateIn; input [1:0]Sel; input Enable; output reg DateOut;
always @(Enable or Sel or DateIn) if(Enable) DateOut = 0; else DateOut = DateIn[Sel]; endmodule
//74HC153测试平台代码 // test_153.v
`timescale 1ns/1ns module test_153(); wire out; reg [3:0]in; reg [1:0]sel; reg ei;
HC153 u(out, in, sel, ei);
initial begin
ei = 0; sel = 0; in = 4'b1010;
repeat(4)
#10 sel = sel +1;
ei = 1; sel = 0; in = 4'b1010;
repeat(4)
11
共分享92篇相关文档