Advertisement
Guest User

calcu

a guest
Aug 3rd, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date: 03.08.2018 15:02:23
  7. // Design Name:
  8. // Module Name: calculadoradysplay
  9. // Project Name:
  10. // Target Devices:
  11. // Tool Versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21.  
  22.  
  23. module calculadoradysplay(
  24.     input logic [15:0] OP1,
  25.     input logic [15:0] OP2,
  26.     input logic [1:0] operacion,
  27.     input logic CLK100MHZ,
  28.     output logic [7:0] D7S,
  29.     output logic [7:0] AN
  30.     );
  31.     logic [31:0]SW = {OP2,OP1};
  32.     logic [7:0] output_an;
  33.     logic [7:0] output_7s;
  34.     logic [8:0] resultado;
  35.     logic [31:0] dsp_num;
  36.     logic [31:0] def_output = {8'b0, SW[7:0], 8'b0, SW[15:8]};//$$$$$$$
  37.    
  38.     alu4 ALU (
  39.     .button(operacion),
  40.     .numeroA(SW[15:0]),
  41.     .numeroB(SW[31:16]),
  42.     .resultado(resultado)
  43.     );
  44.    
  45.     drv_7seg DRV7SEG(
  46.     .in_num(dsp_num),
  47.     .clk(CLK100MHZ),
  48.     .D7S(D7S),
  49.     .AN(AN)
  50.     );
  51.    
  52.     always_comb
  53.     begin
  54.         if (SW == 4'b0001 || SW == 4'b0010 || SW == 4'b0100 || SW == 4'b1000)
  55.             dsp_num = {23'b0, resultado};
  56.         else
  57.             dsp_num = def_output;
  58.     end
  59. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement