![]() |
|
||||||||||||||
| . 网站首页 . 新闻 . 新品 . 方案 . 专访 . 活动 . DSP . EDA . 评测室 . 技术文库 . 会员区 . 商城 . 服务导航 . 邮购 . 资源 . | ||
|
||
|
|||||
| 38译码器仿真 | |||||
作者:Free 文章来源:Free 点击数: 更新时间:2007-12-30 ![]() |
|||||
|
//-------------------------------------------------------------------------------------------------- // File : decoder3_8_TB.v //------------------------------------------------------------------------------------------------- `timescale 1ns / 1ps module decoder3_8_tb; //Internal signals declarations: reg G1; wire [7:0]Y; reg G2; reg [2:0]A; reg G3; // Unit Under Test port map decoder3_8 UUT ( .G1(G1), .Y(Y), .G2(G2), .A(A), .G3(G3)); // -- edit by liwei -- // initial begin G1 = 1; G2 = 1; G3 = 0; # # # # # # # # # # # # # end //$monitor($realtime,,"ps %h %h %h %h %h ",G1,Y,G2,A,G3); endmodule //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------------------------------------------------- // File : decoder3_8.v //------------------------------------------------------------------------------------------------- `timescale 1 ns / 1 ps //{{ Section below this comment is automatically maintained // and may be overwritten //{module {decoder3_8}} module decoder3_8 ( G1 ,Y ,G2 ,A ,G3 ); input G1 ; wire G1 ; input G2 ; wire G2 ; input [2:0] A ; wire [2:0] A ; input G3 ; wire G3 ; output [7:0] Y ; reg [7:0] Y ; reg s; //}} End of automatically maintained section // -- edit by liwei -- // always @ ( A ,G1, G2, G3) begin s <= G2 | G3 ; if ( G1 == 0) Y <= 8'b1111_1111; else if ( s) Y <= 8'b1111_1111; else case ( A ) 3'b000 : Y<= 8'b1111_1110; 3'b001 : Y<= 8'b1111_1101; 3'b010 : Y<= 8'b1111_1011; 3'b011 : Y<= 8'b1111_0111; 3'b100 : Y<= 8'b1110_1111; 3'b101 : Y<= 8'b1101_1111; 3'b110 : Y<= 8'b1011_1111; 3'b111 : Y<= 8'b0111_1111; endcase end endmodule 注意以下语句中,1和2之间的并列关系,时钟来临时1和2是同时执行的。当G1=1,G2=1,G3=0时,同时执行1和2的代码,执行1的结果是,s<=1;2只执行case(A)语句 begin 1. s <= G2 | G3 ; 2. if ( G1 == 0) Y <= 8'b1111_1111; else if ( s) Y <= 8'b1111_1111; else case ( A ) |
|||||
| 欢迎点击进入:TI德州中文网 (国内唯一针对TI应用的中文技术网站) 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 没有相关文章 |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 | | |||
|
|