Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module fib_G(in, out);
  2.     input [3:0]in;
  3.     output out;
  4.     wire nota,notb,notc,notd;
  5.     wire nanda,nandb,nandc,nandd;
  6.     wire step1a,step1b;
  7.     wire nstep1a,nstep1b;
  8.     nand djide(nota,in[3]);
  9.     nand gigdj(notb,in[2]);
  10.     nand jdjej(notc,in[1]);
  11.     nand heidk(notd,in[0]);
  12.    
  13.     nand fjgie(nanda,nota,notc,in[0]);
  14.     nand fndos(nandb,nota,notb);
  15.     nand diejf(nandc,in[2],notc,in[0]);
  16.     nand fudke(nandd,notb,notc,notd);
  17.    
  18.     nand dirjf(step1a,nanda,nandb);
  19.     nand firjd(step1b,nandc,nandd);
  20.    
  21.     nand gobnb(nstep1a,step1a);
  22.     nand higkr(nstep1b,step1b);
  23.    
  24.     nand fhgit(out,nstep1a,nstep1b);
  25.  
  26.     //your code here
  27. endmodule
  28.  
  29. module fib_D(in, out);
  30.     input [3:0]in;
  31.     output out;
  32.            
  33.          
  34.            
  35.             /*Be careful, "!" and "~" are different in Verilog.*/
  36.     assign out=(!in[3]&!in[1]&in[0])|(!in[3]&!in[2])|(in[2]&!in[1]&in[0])|(!in[2]&!in[1]&!in[0]);
  37.     //your code here
  38. endmodule
  39.  
  40. module fib_B(in, out);
  41.     input [3:0]in;
  42.     output out;
  43.     reg out;
  44.      always@(*)begin
  45.                 case(in)
  46.                     0,1,2,3,5,8,13:begin
  47.                         out=1'b1;
  48.                     end
  49.                     default:begin
  50.                         out=1'b0;
  51.                     end
  52.                 endcase
  53.             end
  54.    
  55.     //wryyyyy
  56. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement