Advertisement
Guest User

Microprocessor

a guest
May 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Engineer:
  4. // Create Date: 20.05.2019 20:50:24
  5. // Module Name: micro_example
  6. // Project Name:
  7. //////////////////////////////////////////////////////////////////////////////////
  8.  
  9.  
  10. module micro_example(
  11.     input wire clk, rst,
  12.     input wire PCenable,
  13.     input wire extCtl,
  14.     input wire [3:1] sw,
  15.     output wire[3:0] led,
  16.     output wire[3:0] an,
  17.     output wire[7:0] seg
  18.     );
  19.    
  20. reg [15:0] monRFData, monInstr, monPC;
  21. wire [3:0] dp_in;
  22. reg [3:0] monRFSrc;
  23.  
  24. micro my_micro
  25. (
  26.     .clk(clk),
  27.     .reset(rst),
  28.     .PCenable(PCenable),
  29.     .extCtl(extCtl),
  30.     .monRFData(monRFData),
  31.     .monInstr(monInstr),
  32.     .monPC(monPC),
  33.     .monRFSrc(monRFSrc)
  34. );
  35.    
  36. debounce my_debounce
  37. (
  38.     .clk(clk),
  39.     .reset(rst),
  40.     .sw(sw),
  41.     .db_tick(PCenable),
  42.     .db_level(extCtl)
  43. );
  44.  
  45. reg [15:0] display;
  46.  
  47. disp_hex_mux my_disp_hex_mux
  48. (
  49.     .clk(clk),
  50.     .reset(rst),
  51.     .hex3(display[15:12]),
  52.     .hex2(display[11:8]),
  53.     .hex1(display[7:4]),
  54.     .hex0(display[3:0]),
  55.     .dp_in(dp_in),      
  56.     .an(an),  
  57.     .sseg(seg)
  58. );
  59.    
  60. always @(posedge clk) begin
  61.     if (sw[0]) begin
  62.         display[15:0] = monInstr[15:0];
  63.     end
  64.     if (sw[1]) begin
  65.         display[15:0] = monPC[15:0];
  66.     end
  67.     if (sw[3]) begin
  68.         display[15:0] = monRFData[15:0];
  69.     end
  70. end
  71.    
  72. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement