0

I used the following code to set up my ICE40HX1K-VQ100 fpga to input an external clock:

 SB_GB_IO gb_io1 (
    .PACKAGE_PIN( clk ),
    .GLOBAL_BUFFER_OUTPUT( gclk )
 );

This is for pin IOL_6B_GBIN7.

By itself, this works fine but I also needed to input an external event signal, so I added this code:

SB_GB_IO gb_io2 (
   .PACKAGE_PIN( cmp ),
   .GLOBAL_BUFFER_OUTPUT( gcmp )
);

this is for pin IOR_61_GBIN2.

Well, that is not working so good. I thought that this is what the primitive tech library meant. If I just use the clk I am ok. The cmp pin doesn't work as a wire. When I tried to use the code above it still doesn't work and acts like it doesn't see the signal at that pin.

So, after warping my brain trying to understand the documentation, I have to holler UNCLE. Could someone give me a hand with this please?

Salomon Zhang
  • 1,553
  • 3
  • 23
  • 41

1 Answers1

0

I believe the answer is that the SB_GB_IO primitive require some parameter(s) when used for your gcmp signal. In particular it can be advantageous to specify something like defparam gb_io2.PIN_TYPE = 6'b000001;. Please refer to SBT_ICE_Technology_Library.pdf (available either from the Lattice web-site, or in the directory doc of iCEcube2 software) to find a description of the possibilites of parameters to the primitives.

I do not know your exact requirements, are you sure you need a global buffer for the gcmp signal? Perhaps something like the following would work?

SB_GB_IO gb_io1 
  ( .PACKAGE_PIN(clk), 
    .OUTPUT_ENABLE(1'b1),
    .GLOBAL_BUFFER_OUTPUT(gclk)
    );
defparam gb_io1.PIN_TYPE = 6'b000001;
defparam gb_io1.PULLUP = 1'b0;
defparam gb_io1.NEG_TRIGGER = 1'b0;
defparam gb_io1.IO_STANDARD = "SB_LVCMOS";

SB_IO cmp_pad 
  (.PACKAGE_PIN(cmp), 
   .OUTPUT_ENABLE(1'b1), 
   .D_IN_0(gcmp)); 
defparam cmp_pad.PIN_TYPE = 6'b000001;
defparam cmp_pad.PULLUP = 1'b0;
defparam cmp_pad.NEG_TRIGGER = 1'b0;
defparam cmp_pad.IO_STANDARD = "SB_LVCMOS";

Welcome to Stack Overflow.

Baard
  • 809
  • 10
  • 26
  • As I had it written the clk signal worked fine. I had thought originally that simuler code would work for the event signal. I had read over all the documentation and could not see how those pins were set up. I would like to understand this and if you could point out where in the documentation I would read about it I would be grateful. I am trying not to cookbook this code but know what I am doing and why. – Steve Brown Apr 26 '19 at 21:05
  • @SteveBrown, I have added a not-to-good reference to the documentation of ICE40 primitives in the answer. As you know how to use primitives I assumed you had this information already. – Baard Apr 26 '19 at 22:41
  • Thanks for you good help Baard. I saw that code but I had trouble with the surrounding documentation. I have been programming for over 40 years and have used over 20 different languages but, boy that documentation really was as clear as mud. I don't like "magic" number without an adequate explanation or documentation, they drive me crazy. I am trying your code for the clk line and will let you and the others here know of my results. I ended up going to a non-global pin to handle the other event and it looks ok. – Steve Brown Apr 28 '19 at 15:28
  • The documentation is, in my opinion, clearly lacking in most respects. This is a pity, because I think Silicon Blue did a lot of things right. I suppose you know the admirable resource http://www.clifford.at/icestorm? The original ice65datasheet.pdf (if you can find it), though obsolete, also give a few details on the thinking of the Silicon Blue engineers. – Baard Apr 28 '19 at 22:03