夏宇闻老师优秀的verilog教程课件

源代码在线查看: clk_gen.v

软件大小: 1045 K
上传用户: dojoy
关键词: verilog 教程
下载地址: 免注册下载 普通下载 VIP

相关代码

				// ?????
				//------------------------------------------------------------------------------------------------------------
				module clk_gen (clk,reset,clk1,clk2,clk4,fetch,alu_clk);
				input clk,reset;
				output clk1,clk2,clk4,fetch,alu_clk;
				wire clk,reset;
				reg clk2,clk4,fetch,alu_clk;
				reg[7:0] state;
				parameter    S1 = 8'b00000001,
				             S2 = 8'b00000010,
				             S3 = 8'b00000100,
				             S4 = 8'b00001000,
				             S5 = 8'b00010000,
				             S6 = 8'b00100000,
				             S7 = 8'b01000000,
				             S8 = 8'b10000000,
				           idle = 8'b00000000;
				                 
				assign clk1 = ~clk;
				
				always @(negedge clk)
				   if(reset)
				           begin
				                clk2 				                clk4 				                fetch  				                alu_clk 				                state 				           end
				   else
				           begin 
				              case(state)
				                 S1:
				                      begin
				                            clk2 				                         alu_clk 				                           state 				                      end
				                 S2:
				                      begin
				                          clk2 				                          clk4 				                       alu_clk 				                         state 				                      end
				                 S3:
				                      begin   
				                          clk2 				                         state 				                      end
				                 S4:
				                      begin
				                          clk2  				                          clk4  				                          fetch 				                          state 				                      end
				                 S5:
				                       begin
				                          clk2  				                          state 				                       end
				                 S6:
				                       begin
				                           clk2  				                            clk4 				                           state 				                        end
				                 S7:
				                        begin
				                             clk2  				                             state 				                        end
				                 S8:
				                        begin
				                             clk2 				                            clk4  				                            fetch 				                            state 				                        end
				                idle:       state 				                default:    state 				            endcase
				     end
				endmodule
				//--------------------------------------------------------------------------------
							

相关资源