• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with shift opertor (<<)
#1
I'm using the CU board with the iCEcube2 toolchain. I have connected the board LEDs to the "out" output of this minimal module. When I add to the value of "outbfr" I can see the LEDs count up by one once a second. When I comment out that line and leave the line with the left shift then no LEDs are illuminated. Pressing the reset button illuminates the LEDs in the 10101010 pattern as specified in the init value (so the connection and the physical LEDs are fine). Any ideas?

module foo (
    input clk,  // clock
    input rst,  // reset
    output out[8]
  ) {

  .clk(clk){
     .rst(rst){
        dff outbfr[8](#INIT(8b10101010));
        dff main_clock_count[$clog2(50000000)];
      }
  }
 
  always {
    out = outbfr.q;
    main_clock_count.d = main_clock_count.q + 1;
    if (main_clock_count.q == 50000000) {
      outbfr.d = outbfr.q + 1; // works
      outbfr.d = outbfr.q << 1; //doesn't
      main_clock_count.d = 0;
    }
  }
}
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)