设为首页收藏本站淘宝杂货铺

从F到0 - From F to 0

 找回密码
 注册已关闭
搜索
查看: 209|回复: 0
收起左侧

Quartus Verilog HDL/FPGA 组合逻辑模块实例化实现判断一个11位手机号码格式是否有效

[复制链接]
发表于 2023-3-10 18:27:05 | 显示全部楼层 |阅读模式
main.png
  1. module is_cell_phone_number(                //手机号格式判断模块
  2.         input [34:0] number,                //35位宽 11位手机号 范围:13000000000~19999999999
  3.         output ok                                        //有效输出1 无效输出0
  4. );
  5.         assign ok = (number >= 35'd13000000000 && number <= 35'd19999999999) ? 1'd1 : 1'd0;
  6. endmodule

  7. module main(
  8.         input clk,                        //时钟输入
  9.         output reg led                //低电平(计算正确)点亮
  10. );

  11. wire ok;
  12. is_cell_phone_number U1(
  13.         .number(35'd18888888888),
  14.         .ok(ok)
  15. );

  16. always @(posedge clk) begin
  17.         led <= !ok;
  18. end
  19. endmodule

复制代码

相关帖子

您需要登录后才可以回帖 登录 | 注册已关闭

本版积分规则

QQ|手机版|Archiver|从F到0 ( 蒙ICP备17002595号-1 )
蒙公网安备15010402000325号

腾讯云安全认证

GMT+8, 2024-4-26 03:49 , Processed in 0.674038 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表