Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
加法器源程序.v
Package: VHDL 的实例程序,共44个.rar [view]
Upload User: easylife05
Upload Date: 2013-03-21
Package Size: 42k
Code Size: 1k
Category:
VHDL-FPGA-Verilog
Development Platform:
C/C++
- // download from: www.pld.com.cn & www.fpga.com.cn
- module counter (count, clk, reset);
- output [7:0] count;
- input clk, reset;
- reg [7:0] count;
- parameter tpd_clk_to_count = 1;
- parameter tpd_reset_to_count = 1;
- function [7:0] increment;
- input [7:0] val;
- reg [3:0] i;
- reg carry;
- begin
- increment = val;
- carry = 1'b1;
- /*
- * Exit this loop when carry == zero, OR all bits processed
- */
- for (i = 4'b0; ((carry == 4'b1) || (i <= 7)); i = i+ 4'b1)
- begin
- increment[i] = val[i] ^ carry;
- carry = val[i] & carry;
- end
- end
- endfunction
- always @ (posedge clk or posedge reset)
- if (reset)
- count = #tpd_reset_to_count 8'h00;
- else
- count <= #tpd_clk_to_count increment(count);
- /*
- * To make module counter synthesizeable, use the following
- * alternate form of the always block:
- */
- /***********************************************
- always @ (posedge clk or posedge reset)
- if (reset)
- count <= 8'h00;
- else
- count <= count + 8'h01;
- ***********************************************/
- endmodule