Convolutional Neural Networks (CNN) show huge necessity in medical area diagnosis, CNN can be used for ECG features extraction, heartbeats classification and abnormal beats detection, helping clinicians to get the true diagnosis of cardiovascular diseases at early stage. In this context, an optimized CNN is proposed to be implemented on Pynq-Z2 board for Electrocardiography (ECG) signal class detection. As first step, a CNN has been implemented on the processor ARM Cortex A9 of Pynq Z2. Implementation results show the efficiency of our purpose, achieving accuracies results of 98.86%, 98.61% and 98.39% for the training, validation and test process respectively. Then to improve the inference results a Hardware/Software Codesign has been proposed due to the parallel architecture of FPGA, time process acceleration has reached 10 times compared to the implementation on the Processor. Moreover, a gain of the surface has been achieved by using low number of resources. Thus, a real time application has been reached with a very excellent class accuracy detection going to 99.45% for the training, 99.12% for the validation and 99.03% for the testing processes, when tested on MIT-BIH ECG signals in a short time process with 0.0018s/signal through the test process and 0.005s/ signal during the training.