Advertisement
regzarr

LSIC - Main System

Nov 25th, 2024 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module MainSystem(
  2.     input rst,
  3.     input clk,
  4.     input switch_pause,
  5.     input btn_start,
  6.     output [6:0] hex0, hex1, hex2, hex3, hex4, hex5
  7. );
  8.  
  9.     wire clk_2_5MHz;
  10.     wire [31:0] ms_count;
  11.     reg [1:0] opcode;
  12.    
  13.  
  14.     FrequencyDivider freq_div (
  15.         .clk_in(clk),
  16.         .rst(rst),
  17.         .clk_out(clk_2_5MHz)
  18.     );
  19.  
  20.     TimeMeasurement timer (
  21.         .clk(clk_2_5MHz),
  22.         .rst(rst),
  23.         .opcode(opcode),
  24.         .ms_count(ms_count)
  25.     );
  26.  
  27.     SevenSegmentController display (
  28.         .ms_count(ms_count),
  29.         .hex0(hex0),
  30.         .hex1(hex1),
  31.         .hex2(hex2),
  32.         .hex3(hex3),
  33.         .hex4(hex4),
  34.         .hex5(hex5)
  35.     );
  36.  
  37.     always @(*) begin
  38.         opcode = 2'b00;
  39.         if (btn_start) opcode = 2'b01;
  40.         if (switch_pause) opcode = 2'b11;
  41.     end
  42.  
  43. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement