Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module if_stage(pc, instruction, pcSrc, offset, clk);
  2.     output reg [31:0] pc = 0;
  3.     output [31:0] instruction;
  4.  
  5.     input pcSrc, clk;
  6.     input [31:0] offset;
  7.  
  8.     assign instruction = 0;
  9.    
  10.     always@(posedge clk)
  11.         pc = pc + 1;
  12.    
  13. endmodule
  14.  
  15. module main;
  16.     reg clk = 1'b0;
  17.     reg pcSrc = 1'b0;
  18.     wire [31:0] pc = 0;
  19.     wire [31:0] instruction = 0;
  20.     reg [31:0] offset = 0;
  21.     if_stage if_stage(pc, instruction, pcSrc, offset, clk);
  22.    
  23.     initial #300 $finish;
  24.     initial
  25.         begin
  26.             repeat (10)
  27.             #10 clk = ~clk ;
  28.         end
  29.    
  30.     initial
  31.     begin
  32.         $monitor("Clk:%d, PC:%d, I:%d, PCSrc:%d, Offset:%d", clk, pc, instruction, pcSrc, offset);
  33.     end
  34.    
  35. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement