Forum Discussion
Issues Converting VHDL to Verilog for DE10 Standard Board
- 1 year ago
Hi,
the VHLD is almost correctly translated, except for one assignment which apparently misplacedVHDL
-- Copy the input clock signal
aud_bk <= aud_clock_12;-- Main process for generating control signals and sending audio data
process(aud_clock_12)Verilog
always @(negedge(aud_clock_12)) beginaud_bk <= aud_clock_12;
Asignment must be placed outside clock sensitive block, otherwise it won't generate a clock at all
assign aud_bk = aud_clock_12;There's also something wrong with the Verilog PLL instantiation which seems to be mixed with onchip memory.pll u0 (
.clk_clk(CLOCK_50),
.reset_reset_n(1'b1),
.clock_12_clk(clock_12pll),
.onchip_memory2_0_s1_address(ROM_ADDR),
.onchip_memory2_0_s1_clken(1'b1),
.onchip_memory2_0_s1_chipselect(1'b1),
.onchip_memory2_0_s1_debugaccess(1'b0),
.onchip_memory2_0_s1_write(1'b0),
.onchip_memory2_0_s1_readdata(ROM_OUT),
.onchip_memory2_0_s1_writedata(16'b0),
.onchip_memory2_0_s1_byteenable(2'b11),
.onchip_memory2_0_reset1_reset(1'b0)
);Regards
Frank
Hi,
you can mix Verilog and VHLD code and check which of the three sources fail.
I'd need the original VHDL to check where the logic has been possibly changed. I see a dubious detail in i2c.v, it's driving SDA to '1' in serveral places which should never happen. Is it also done in the VHDL code? I presume push-pull drive of SCL is copied from VHDL. It's not strictly following I2C specification but can be done in a single master system if no slave is supporting clock stretching.
Regards
Frank
Hi Frank,
Thank you so much for your reply. For your reference, I am attaching three text files that include the VHDL code corresponding to the three Verilog files (as the .vhdl extension is not supported).
Regarding the SDA being driven to '1' in the Verilog code, my main purpose here is to translate the VHDL code to Verilog (which I need the file in the "*.v" not ".vhdl" format. In the original VHDL code, the author drives SDA to '1' in some scenarios. For example:
-- Transmit data on SDA when SCL is LOW if (clk_en = '1') then case i2c_fsm is when st0 => -- Idle state i2c_sda <= '1'; -- Keep SDA high i2c_busy <= '0'; i2c_done <= '0'; if (i2c_send_flag = '1') then i2c_fsm <= st1; -- Start communication i2c_busy <= '1'; end if; when st1 => -- Send START condition i2c_sda <= '0'; i2c_fsm <= st2; data_index <= 7;
I translated this behavior directly into Verilog, which is why SDA is driven to '1' in the corresponding cases. If there’s a better approach or improvement you would suggest, I’m open to refining the code further to align with best practices or specific requirements.
Thank you again for your time and guidance.