elevator.v ( File view )

  • By rajaram431 2016-04-21
  • View(s):0
  • Download(s):0
  • Point(s): 1
			`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    14:51:15 04/25/2012 
// Design Name: 
// Module Name:    elevator 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module elevator(clk,rst,datain,out0,out1,out2,out3,door_open,door_open1,door_open2,door_open3);
input clk,rst;
input [1:0]datain;
//output  out0,out1,out2,out3;
output reg  out0,out1,out2,out3;
output reg door_open,door_open1,door_open2,door_open3;
reg [1:0] state,nextstate;
parameter s0=0,s1=1,s2=2,s3=3;
always@(posedge clk,posedge rst)
begin
if(rst)
state=s0;
else state=nextstate;
end

always@(state,datain)
begin
nextstate=s0;
case(state)
  s0:begin 
  if(datain==2'b01)
      nextstate=s1;
	  else if(datain==2'b10)
      nextstate=s2;
     else if(datain==2'b11)
      nextstate=s3;
     else nextstate=s0; end
	s1:begin 
	if(datain==2'b10)
      nextstate=s2;
      else if(datain==2'b11)
      nextstate=s3;
		else if(datain==2'b00)
		nextstate=s0;
		else nextstate=s1; end
	s2:begin 
	 if(datain==2'b11)
      nextstate=s3;
      else if(datain==2'b01)
      nextstate=s2;
      else if(datain==2'b00)
      nextstate=s0;
      else nextstate=s2; end
  s3: begin 
   if(datain==2'b10)
      nextstate=s2;
      else if(datain==2'b01)
      nextstate=s1;
      else if(datain==2'b
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
code.exe813.00 kB25-09-10|11:00
elevator.exe813.00 kB25-09-10|11:00
elevator.v2.29 kB22-05-12|16:49
elevator_tb.v1.37 kB22-05-12|17:00
eleva_tb.v1.43 kB22-05-12|16:56
escalator.exe813.00 kB25-09-10|11:00
escalator.v1.00 kB11-07-13|17:35
escalator_tb.v1.42 kB18-05-12|15:23
elevator0.00 B06-01-15|17:14
escalator0.00 B21-04-16|10:29
code0.00 B21-04-16|10:29
...
Sponsored links

elevator.v (889.63 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D