EmbDev.net

Forum: FPGA, VHDL & Verilog Verilog VGA Out


von (unknown) (Guest)


Rate this post
useful
not useful
The following code fragment shows the score text in the top left corner. 
I need to move it to the top right corner.
How can I change the coordenates to do that?
I have been trying to do that, but no effects.

// score region
   //  - display two-digit score, ball on top left
   //  - scale to 16-by-32 font
   //  - line 1, 16 chars: "Score:DD Ball:D"
   //-------------------------------------------
   assign score_on = (pix_y[9:5]==0)&&(pix_x[9:4]<16);
   assign row_addr_s = pix_y[4:1];
   assign bit_addr_s = pix_x[3:1];
   always @*
      case (pix_x[7:4])
          4'h0: char_addr_s = 7'h53; // S
          4'h1: char_addr_s = 7'h63; // c
          4'h2: char_addr_s = 7'h6f; // o
          4'h3: char_addr_s = 7'h72; // r
          4'h4: char_addr_s = 7'h65; // e
          4'h5: char_addr_s = 7'h3a; // :
          4'h6: char_addr_s = {3'b011, dig1}; // digit 10
          4'h7: char_addr_s = {3'b011, dig0}; // digit 1
          4'h8: char_addr_s = 7'h00; //
          4'h9: char_addr_s = 7'h00; //
          4'ha: char_addr_s = 7'h42; // B
          4'hb: char_addr_s = 7'h61; // a
          4'hc: char_addr_s = 7'h6c; // l
          4'hd: char_addr_s = 7'h6c; // l
          4'he: char_addr_s = 7'h3a; // :
          4'hf: char_addr_s = {5'b01100, ball};
      endcase

von Michael E. (cuby)


Rate this post
useful
not useful
The top right corner is already occupied by the "Ball:" text, so this 
must be either moved or not displayed at all. Changing the position of 
the "Score:"+digits should be easy, simply change the constants in the 
case statement, e.g., to start at 4'h8 for the "S" and then go on using 
4'h9, 4'ha... for the subsequent characters and the tens and ones 
digits.

In case other readers were wondering, this is code from a Verilog Pong 
implementation, which can e.g. be found at 
https://github.com/bogini/Pong/blob/master/pong_text.v

-- Michael

PS: I hope you didn't just try to get some easy homework solution for 
your FPGA class... :-)

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.