Now, truly begin the 'geometry_xy_plotter.sv'. Start with being able to load it's internal storage registers with the command input port.
Use the maggie.sv and rs232_DEBUGGER.v to get an idea of how to associate/assign labels from the source command & how to store those labels into the memory registers. The labels and registers should be almost identical to the geo.bas labels. Except for the x# & y#, make them 2 dimensional 12 bit registers for ease of design. (I should have done that anyways within geo.bas. Sorry, my bad.
I'd be lying if I said I knew what I was doing, so I've thrown some code at the Quartus project and I'm hoping what stuck is vaguely going in the right direction.. ![Huh? ???](https://www.eevblog.com/forum/Smileys/default/xhuh.gif.pagespeed.ic.6Nvt7O8a11.png)
Have got as far as the functions (I think) - not sure how to progress. Anyway, take a look at the attached and let me know where I've gone wrong so far. ![Roll Eyes ::)](https://www.eevblog.com/forum/Smileys/default/rolleyes.gif.pagespeed.ce.XcUK202Yqt.gif)
EDIT:
Updated code as I hadn't created registers for max_x, max_y or the two collision counters. ![Face Palm :palm:](https://www.eevblog.com/forum/Smileys/default/xfacepalm.gif.pagespeed.ic.EBDwh1hCfo.png)
Ok, a little mistake on my part, these guys will be in the inside the memory pixel writer... So they have to be removed.
output Write_col[7:0], // An 8 bit saturation counter which counts the number of pixel write collisions
output Copy_col[7:0], // An 8 bit saturation counter which counts the number of blit write from read pixel write collisions
output idle // An output which goes high when the geometry plotter is finished and is doing nothing
Next, your first 4 assigns need the destinations to have wires declared.
Next, this module's outputs are also wires (as well as the inputs). (See maggie.sv for example.)
To begin with, make all your inputs and outputs on the ports 'wire'. Look at maggie.sv to see how this is done. You have the [x:y] on the wrong side of the names.
next make these 5 regs:
draw_cmd_func[3:0]
draw_cmd_data_color[7:0]
draw_cmd_data_word_Y[11:0]
draw_cmd_data_word_X[11:0]
draw_cmd_tx
Then I would assign the output port wire to them:
draw_cmd[35:32] = draw_cmd_func[3:0]
draw_cmd[31:24] = draw_cmd_data_color[7:0]
draw_cmd[23:12] = draw_cmd_data_word_Y[11:0]
draw_cmd[11:0] = draw_cmd_data_word_X[11:0]
draw_cmd_rdy = draw_cmd_tx
Make 16 localparams CMD_OUT_#choose a function name# and make each = to the AUX# in my comments.
Then when sending a command, all you need to do is:
begin
draw_cmd_func <= CMD_OUT_#choose a function name#[3:0];
draw_cmd_data_color <= 'usually the draw color'
draw_cmd_data_word_Y <= 'usually Y coordinate'
draw_cmd_data_word_X <= 'usually X coordinate'
draw_cmd_tx <= 1;
end ...
else if no other new commands running draw_cmd_tx <=0 ;
Basically, when sending a command, the 'draw_cmd' should have the right data and the 'draw_cmd_rdy' should go high same time. The 'draw_cmd_rdy' may only be high for additional clocks if the next command going out is ready to go.
Basically when sending a command, make the draw_cmd_rdy =1, when doing nothing, or default state, make it =0.
I left out the things you should be able to work out on your own...
After this, compile in Quartus 9.1 on a schematic with inputs and outputs & try sending a few of the current completed commands and see if the output simulate right.
See attached 'geometry_xy_plotter.sv' where I tell you where and when you send out a command...