Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module top();
  2.     //instantiere modul uart presupunem RX registru de trimis => fpga
  3.     reg receive_byte;
  4.     always@(posedge clk) begin
  5.         receive_byte <= RX;
  6.     end
  7.    
  8.     wire sq_a, sq_b, sq_c, sq_d, sq_e, sq_f, sq_g, sq_h;
  9.    
  10.     always@(posedge clk) begin
  11.         // SET 1 DE BARE
  12.         sq_a <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0; // pozitiile tale tb adaugate
  13.         sq_b <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  14.         sq_c <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  15.         sq_d <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  16.         // SET 2 DE BARE
  17.         sq_e <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  18.         sq_f <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  19.         sq_g <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  20.         sq_h <= ((x > 120) & (y >  40) & (x < 280) & (y < 200)) ? 1 : 0;
  21.         case(receive_byte) // dc bitul trimis de uC e 1
  22.         1: begin
  23.             // Bara 'a' e rosie, 'b' e verde, 'c' e albastra, 'd' e albastra si verde adica galben
  24.             VGA_R[3] <= sq_a;
  25.             VGA_G[3] <= sq_b | sq_d;
  26.             VGA_B[3] <= sq_c | sq_d;
  27.            end
  28.         2: begin // altfel dc e 2 intra setul 2
  29.             VGA_R[3] <= sq_e; // 'e' e rosu si verde si albastru, f e verde, g e albastru, h e albastru
  30.             VGA_G[3] <= sq_e | sq_f;
  31.             VGA_B[3] <= sq_g | sq_e | sq_h;
  32.            end
  33.         endcase
  34.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement