Advertisement
Guest User

verilog code

a guest
Aug 4th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. code:
  2.  
  3. module trapverilog(
  4.     input CLK,
  5.     input SIGNALP,
  6.      input SIGNAL1,
  7.      input SIGNAL2,
  8.      input SIGNAL3,
  9.      input SIGNAL4,
  10.      input SIGNAL5,
  11.      input SIGNAL6,
  12.      input SIGNAL7,
  13.      input X1,
  14.      input X2,
  15.      input X3,
  16.      input X4,
  17.      input X5,
  18.      input X6,
  19.      input X7,
  20.      input SUMP,
  21.      input SUM1,
  22.      input SUM2,
  23.      input SUM3,
  24.      input SUM4,
  25.      input SUM5,
  26.      input SUM6,
  27.      input SUM7, // OUT pins are mapped to SUM pins on board
  28.     output reg OUTP,
  29.      output reg OUT1,
  30.      output reg OUT2,
  31.      output reg OUT3,
  32.      output reg OUT4,
  33.      output reg OUT5,
  34.      output reg OUT6,
  35.      output reg OUT7
  36.     );
  37.  
  38. reg[6:0] yregone;
  39. reg[6:0] yregtwo;
  40. reg[6:0] sum;
  41. wire [6:0] SUM;
  42. assign SUM = {SUM1, SUM2, SUM3, SUM4, SUM5, SUM6, SUM7};
  43. wire [7:0] SIGNAL;
  44. assign SIGNAL = {SIGNAL1, SIGNAL2, SIGNAL3, SIGNAL4, SIGNAL5, SIGNAL6, SIGNAL7};
  45. wire [6:0] x;
  46. assign x = {X1. X2. X3. X4. X5, X6, X7};
  47.  
  48. always @(posedge CLK)
  49. begin
  50.     if (SIGNALP == 1)
  51.     begin
  52.         SIGNAL = SIGNAL * -1;
  53.     end
  54.  
  55.     if (SUMP == 1)
  56.     begin
  57.         SUM = SUM * -1;
  58.     end
  59.    
  60.     yregtwo = yregone;
  61.     yregone = SIGNAL;
  62.    
  63.     if (yregtwo != 0)
  64.     begin
  65.         sum = ((yregone + yregtwo)*x/2) + SUM; //treats x as plain h, change if treated as h/2
  66.        
  67.         if (sum < 0)
  68.         begin
  69.             OUTP = 1;
  70.         end
  71.        
  72.         OUT1 = sum[1];
  73.         OUT2 = sum[2];
  74.         OUT3 = sum[3];
  75.         OUT4 = sum[4];
  76.         OUT5 = sum[5];
  77.         OUT6 = sum[6];
  78.         OUT7 = sum[7];
  79.     end
  80. end
  81.  
  82. endmodule
  83.  
  84. errors:
  85.  
  86. ERROR:HDLCompiler:1660 - "/home/ise/FPGA/trapezoid/trapverilog.v" Line 70: Procedural assignment to a non-register SIGNAL is not permitted, left-hand side should be reg/integer/time/genvar
  87. ERROR:HDLCompiler:1660 - "/home/ise/FPGA/trapezoid/trapverilog.v" Line 70: Procedural assignment to a non-register SIGNAL is not permitted, left-hand side should be reg/integer/time/genvar
  88. ERROR:HDLCompiler:1660 - "/home/ise/FPGA/trapezoid/trapverilog.v" Line 75: Procedural assignment to a non-register SUM is not permitted, left-hand side should be reg/integer/time/genvar
  89. ERROR:HDLCompiler:1660 - "/home/ise/FPGA/trapezoid/trapverilog.v" Line 75: Procedural assignment to a non-register SUM is not permitted, left-hand side should be reg/integer/time/genvar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement