I'm a bit of a newbie with FPGAs.
Trying to run the project from the "Getting Started" section of the Lattice Diamond manual.
These are the source files:
module count(c_up,c_down,clk,rst,c_up_2,c_down_2,c_down_3); input clk,rst; output [2:0]c_up; output [2:0]c_down; output [2:0]c_up_2; output [2:0]c_down_2; output [2:0]c_down_3; count_up count_up_inst (.clk(clk), .rst(rst), .c_up(c_up)); count_down count_down_inst (.clk(clk), .rst(rst), .c_down(c_down)); count_up_2 count_up_2_inst (.clk(clk), .rst(rst), .c_up(c_up_2)); count_down_2 count_down_2_inst (.clk(clk), .rst(rst), .c_down(c_down_2)); count_down_3 count_down_3_inst (.clk(clk), .rst(rst), .c_down(c_down_3)); GSR GSR_INST( .GSR(rst)); endmodule
module count_down (clk,rst,c_down)/* synthesis GSR="DISABLED" */; input clk, rst; output [2:0]c_down; reg [2:0]c_down; always @(posedge clk or posedge rst) begin if (rst) c_down = 3'b111; else c_down = c_down - 1; end endmodule
module count_up (clk,rst,c_up)/* synthesis GSR="ENABLED" */; (the rest is essentially the same, just on reset init to 000, and on clk's posedge increase instead of decrease)
count_up_2.v that do the same, increasing or decreasing in steps of 2. And there is a
count_down_3.vhd that seems to do the same, just in steps of 3 when counting down.
The synthesis goes well all the way to generation of the JDEC file. I'm using the TinyFPGA programmer software, and that one reports erasing, flashing, and verifying all OK.
However, the pins of the TinyFPGA board don't move at all. The red LED is on (if I'm understanding correctly, that's just an indicator that the board has the 3.3V power in). Pins 12, 13, 14, 15 show a 1011 output, and most other pins are at 0.
Aside from the obvious question of why is it not working, I have a couple of concrete questions:
- How do I specify the mapping of the pins? (i.e., output signals/variables in the Verilog code corresponding to specific pins on the chip) I can't seem to find any such definition anywhere in the project. I know I specified the correct chip (LCMXO2-1200HC-4SG32C); even if the application just knows the mapping, how do I know the names I need to use to output to or input from a given pin in the chip?
- Do I need to set up the clock? (I guess maybe the chip internally generates a clock with default characteristics --- but I'm not sure whether that's the case, and whether that's what I'm missing?)